LPEX
3.6.6

com.ibm.lpex.fortran
Class FixedFormLexer

java.lang.Object
  extended by com.ibm.lpex.cc.FortranFixedFormTokenManager
      extended by com.ibm.lpex.fortran.FixedFormLexer
All Implemented Interfaces:
FortranFixedFormConstants, IFortranLexer

public final class FixedFormLexer
extends FortranFixedFormTokenManager
implements IFortranLexer

Lexer for Fortran fixed source form.


Field Summary
 
Fields inherited from class com.ibm.lpex.cc.FortranFixedFormTokenManager
curChar, jjnewLexState, jjstrLiteralImages, lexStateNames
 
Fields inherited from interface com.ibm.lpex.cc.FortranFixedFormConstants
_DEFAULT, _INTEGER, _LOGICAL, _NAME, _NUMBER, ACCESS, ACTION, ADVANCE, ALLOCATABLE, ALLOCATE, AND, ANY_CHAR, APPEND, ASIS, ASSIGN, ASSIGNMENT, AUTOMATIC, BACKSPACE, BINARY_CONSTANT, BLANK, BLOCKDATA, BYTE, CALL, CASE, CHARACTER, CLOSE, COL_1, COL_1_CHAR, COL_1_SPACE, COL_2_5, COL_2_5_CHAR, COL_2_5_SPACE, COL_6, COL_6_CHAR, COMMON, COMPLEX, COND_COMP_SENTINEL, CONTAINS, CONTINUE, CYCLE, DATA, DEALLOCATE, DEBUG_LINE, 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, TAB_1_6, TARGET, THEN, TO, tokenImage, TYPE, UNFORMATTED, UNIT, USE, VAL, VIRTUAL, VOLATILE, WAIT, WHERE, WHITE_SPACE, WRITE, XOR
 
Constructor Summary
FixedFormLexer(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)
          Sets style and 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.FortranFixedFormTokenManager
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

FixedFormLexer

public FixedFormLexer(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 (which is set the right margin in effect), and in the COL_1 lexical state. This method is called when the host parser starts a total or incremental parse.

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 FortranFixedForm.jj.

Overrides:
setComment in class FortranFixedFormTokenManager
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)
Sets style and 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 FortranFixedForm.jj.

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

LPEX
3.6.6

Copyright © 2012 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.