LPEX
3.6.8

com.ibm.lpex.fortran
Class FreeFormLexer

java.lang.Object
  extended by com.ibm.lpex.cc.FortranFreeFormTokenManager
      extended by com.ibm.lpex.fortran.FreeFormLexer
All Implemented Interfaces:
FortranFreeFormConstants, IFortranLexer

public final class FreeFormLexer
extends FortranFreeFormTokenManager
implements IFortranLexer

Lexer for Fortran free source form.


Field Summary
 
Fields inherited from class com.ibm.lpex.cc.FortranFreeFormTokenManager
curChar, jjnewLexState, jjstrLiteralImages, lexStateNames
 
Fields inherited from interface com.ibm.lpex.cc.FortranFreeFormConstants
_DEFAULT, _INTEGER, _LOGICAL, _NAME, _NUMBER, ACCESS, ACTION, ADVANCE, ALLOCATABLE, ALLOCATE, AMPERSAND, AMPERSAND_CONT, AND, ANY_CHAR, APPEND, ASIS, ASSIGN, ASSIGNMENT, AUTOMATIC, BACKSPACE, BINARY_CONSTANT, BLANK, BLOCKDATA, BYTE, CALL, CASE, CHARACTER, CLOSE, COMMON, COMPLEX, CONTAINS, CONTINUE, CYCLE, DATA, DEALLOCATE, DEFAULT, DELIM, DIGIT, DIMENSION, DIRECT, DO, DOUBLE, DOUBLECOMPLEX, DOUBLEPRECISION, DOWHILE, EJECT, ELEMENTAL, ELSE, ELSEIF, ELSEWHERE, END, ENDBLOCKDATA, ENDDO, ENDFILE, ENDFORALL, ENDFUNCTION, ENDIF, ENDINTERFACE, ENDMODULE, ENDPROGRAM, ENDSELECT, ENDSUBROUTINE, ENDTYPE, ENDWHERE, ENTRY, EOF, EOL, EOR, EQ, EQUIVALENCE, EQV, ERR, ERROR_LINE, EXIST, EXIT, EXPONENT, EXTERNAL, EXTRINSIC, FILE, FMT, FORALL, FORM, FORMAT, FORMATTED, FUNCTION, GE, GO, GOTO, GT, HEX_CONSTANT, HEXDIGIT, HOLLERITH_CONSTANT, HPF, HPF_LOCAL, HPF_SERIAL, IF, IMPLICIT, IN, IN_COMMENT, IN_DOUBLEQUOTE, IN_SINGLEQUOTE, INCLUDE, INOUT, INQUIRE, INTEGER, INTENT, INTERFACE, INTRINSIC, IOLENGTH, IOSTAT, KIND, LE, LEN, LETTER, LOGICAL, LPAREN, LT, MODULE, MODULEPROCEDURE, NAME, NAMED, NAMELIST, NE, NEQV, NEXTREC, NML, NONE, NOT, NULLIFY, NUM, NUMBER, OCTAL_CONSTANT, ONLY, OPEN, OPENED, OPERATOR, OPTIONAL, OR, OUT, PAD, PARAMETER, PAUSE, POINTER, POSITION, PRECISION, PRINT, PRIVATE, PROCEDURE, PROCESS, PROGRAM, PUBLIC, PUNCTUATION, PURE, Q1, Q2, QA, QB, READ, READWRITE, REAL, REC, RECL, RECURSIVE, REF, RESULT, RETURN, REWIND, RPAREN, SAVE, SELECT, SELECTCASE, SEMICOLON, SEQUENCE, SEQUENTIAL, SHAPE, SIZE, SOURCEFORM, STAT, STATIC, STATUS, STOP, SUBROUTINE, TARGET, THEN, TO, tokenImage, TYPE, UNFORMATTED, UNIT, USE, VAL, VIRTUAL, VOLATILE, WAIT, WHERE, WHITE_SPACE, WRITE, XOR
 
Constructor Summary
FreeFormLexer(LpexCharStream charStream, FortranLexerStyles styles, FortranLexerClasses classes)
          Constructor.
 
Method Summary
 void initialize()
          Initializes the Fortran FF lexer.
 int processToken()
          Retrieves and processes the next Fortran token.
 void reinitialize()
          Reinitializes the Fortran FF lexer.
protected  void setComment(Token t)
          Sets style and class for comments.
protected  void setErrorLine(Token t)
          Set style & class for a line in error ("error.. EOL").
 void setTaskTags(String[] taskTags)
          Sets the comment task tags to use.
 
Methods inherited from class com.ibm.lpex.cc.FortranFreeFormTokenManager
getCurLexState, getNextToken, ReInit, ReInit, SwitchTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeFormLexer

public FreeFormLexer(LpexCharStream charStream,
                     FortranLexerStyles styles,
                     FortranLexerClasses classes)
Constructor.

Parameters:
charStream - LPEX input character stream
styles - style characters to use (predefined by host parser)
classes - classes to use (predefined by host parser)
Method Detail

initialize

public void initialize()
Initializes the Fortran FF lexer. The token manager is initialized for the same character input stream, and in the default lexical state (DEFAULT). This method is normally called when the host parser switches the active lexer to the Fortran FF lexer.

Specified by:
initialize in interface IFortranLexer

reinitialize

public void reinitialize()
Reinitializes the Fortran FF lexer. The token manager is reinitialized for the same character input stream, and in the default lexical state (DEFAULT). This method is normally called after a TokenMgrError exception (e.g., encountered EOF in the middle of a token / a bad character), after the token in error is skipped and parsing is continued (in the same current state).

Specified by:
reinitialize in interface IFortranLexer

setTaskTags

public void setTaskTags(String[] taskTags)
Sets the comment task tags to use.

Specified by:
setTaskTags in interface IFortranLexer
Parameters:
taskTags - array of non-null, non-empty strings, or null if no task tags in effect

processToken

public int processToken()
Retrieves and processes the next Fortran token.

Specified by:
processToken in interface IFortranLexer
Returns:
LEXER_RC_OK, LEXER_RC_EOF [+LEXER_RC_MORE]
See Also:
LpexCommonParser.LEXER_RC_OK, LpexCommonParser.LEXER_RC_EOF, LpexCommonParser.LEXER_RC_MORE

setComment

protected void setComment(Token t)
Sets style and class for comments. Activated by \n encountered while in a comment SPECIAL_TOKEN. SPECIAL_TOKEN, rather than TOKEN, is used for these, as we don't need to see the same tokens in processToken() too, nor have them recorded in the parse.

Does the real work for the method declared in FortranFreeForm.jj.

Overrides:
setComment in class FortranFreeFormTokenManager
Parameters:
t - special token (token.beginLine, token.beginColumn, token.endLine, and token.endColumn identify its location: ONE-based elements and positions in the associated document view)

setErrorLine

protected void setErrorLine(Token t)
Set style & class for a line in error ("error.. EOL"). Activated by \n encountered while in error-line state SPECIAL_TOKEN. SPECIAL_TOKEN, rather than TOKEN, is used for this, as we don't need to see this token in processToken() too.

Does the real work for the method declared in FortranFreeForm.jj.

Overrides:
setErrorLine in class FortranFreeFormTokenManager
Parameters:
t - special token

LPEX
3.6.8

Copyright © 2013 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.