Search in sources :

Example 1 with TMultiCommentEnd

use of de.be4.eventbalg.core.parser.node.TMultiCommentEnd in project probparsers by bendisposto.

the class EventBLexer method collectMultiLineComment.

private void collectMultiLineComment() throws EventBLexerException {
    if (state.equals(State.MULTI_COMMENT)) {
        if (token instanceof EOF) {
            // tokenList.add(token);
            throw new EventBLexerException(token, "Comment not closed");
        }
        /*
			 * Starting a new multiline comment, so first token is
			 * TMultiCommentStart
			 */
        if (commentStart == null) {
            commentStart = (TMultiCommentStart) token;
            commentBuffer = new StringBuilder();
            token = null;
        } else {
            // end of comment reached?
            if (token instanceof TMultiCommentEnd) {
                token = new TComment(commentBuffer.toString(), commentStart.getLine(), commentStart.getPos());
                commentStart = null;
                commentBuffer = null;
                state = State.NORMAL;
            } else {
                commentBuffer.append(token.getText());
                token = null;
            }
        }
    }
}
Also used : TMultiCommentEnd(de.be4.eventbalg.core.parser.node.TMultiCommentEnd) TComment(de.be4.eventbalg.core.parser.node.TComment) EOF(de.be4.eventbalg.core.parser.node.EOF)

Example 2 with TMultiCommentEnd

use of de.be4.eventbalg.core.parser.node.TMultiCommentEnd in project probparsers by bendisposto.

the class EventBLexer method collectMultiLineComment.

private void collectMultiLineComment() throws EventBLexerException {
    if (state.equals(State.MULTI_COMMENT)) {
        if (token instanceof EOF) {
            // tokenList.add(token);
            throw new EventBLexerException(token, "Comment not closed");
        }
        /*
			 * Starting a new multiline comment, so first token is
			 * TMultiCommentStart
			 */
        if (commentStart == null) {
            commentStart = (TMultiCommentStart) token;
            commentBuffer = new StringBuilder();
            token = null;
        } else {
            // end of comment reached?
            if (token instanceof TMultiCommentEnd) {
                token = new TComment(commentBuffer.toString(), commentStart.getLine(), commentStart.getPos());
                commentStart = null;
                commentBuffer = null;
                state = State.NORMAL;
            } else {
                commentBuffer.append(token.getText());
                token = null;
            }
        }
    }
}
Also used : TMultiCommentEnd(de.be4.eventb.core.parser.node.TMultiCommentEnd) TComment(de.be4.eventb.core.parser.node.TComment) EOF(de.be4.eventb.core.parser.node.EOF)

Aggregations

EOF (de.be4.eventb.core.parser.node.EOF)1 TComment (de.be4.eventb.core.parser.node.TComment)1 TMultiCommentEnd (de.be4.eventb.core.parser.node.TMultiCommentEnd)1 EOF (de.be4.eventbalg.core.parser.node.EOF)1 TComment (de.be4.eventbalg.core.parser.node.TComment)1 TMultiCommentEnd (de.be4.eventbalg.core.parser.node.TMultiCommentEnd)1