Class CobolLineStartState


  • public final class CobolLineStartState
    extends AbstractParserState
    The state at the start of a COBOL line, which matches the first letter of a COPY directive.

    Leading spaces, tabs and digits are skipped so that fixed format sources carrying a sequence number in columns 1 to 6 are handled alongside sources that omit it. Any other character ends the line as far as this parser is concerned, which is what keeps comment lines out: the indicator in column 7 of a commented line is "*" or "/", neither of which is skipped.

    • Constructor Detail

      • CobolLineStartState

        public CobolLineStartState​(AbstractParser parser,
                                   char matchLetter,
                                   AbstractParserState nextStateArg)
        Constructor.
        Parameters:
        parser - parser
        matchLetter - letter to match
        nextStateArg - next state if a match on the letter
    • Method Detail

      • consume

        public AbstractParserState consume​(char ch)
        Consumes a character and returns the next state for the parser.
        Specified by:
        consume in class AbstractParserState
        Parameters:
        ch - next character
        Returns:
        the configured nextState on a match, this state while skipping the sequence area, the new line state on an end of line, or null to abandon the rest of the line