straightline/src/main/java/org/poormanscastle/studies/compilers/utils/grammartools/ast/CodePosition.java
/**
     * inputData is expected to be a Token type automatically generated by JavaCC
     * when a JavaCC grammar is evaluated into a lexer and a parser.
     *
     * @param token
     */
inputData is expected to be a Token type automatically generated by JavaCC
when a JavaCC grammar is evaluated into a lexer and a parser.

@param token
inputData is expected to be a Token type automatically generated by JavaCC when a JavaCC grammar is evaluated into a lexer and a parser . @param token
public static CodePosition createFromToken(Object token) {
        try {
            int beginLine = (Integer) token.getClass().getDeclaredField("beginLine").get(token);
            int beginColumn = (Integer) token.getClass().getDeclaredField("beginColumn").get(token);
            int endLine = (Integer) token.getClass().getDeclaredField("endLine").get(token);
            int endColumn = (Integer) token.getClass().getDeclaredField("endColumn").get(token);
            return new CodePosition(beginLine, beginColumn, endLine, endColumn);
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new RuntimeException(e);
        }
    }
public static CodePosition createFromToken ( Object token ) { try { int beginLine = ( Integer ) token . getClass ( ) . getDeclaredField ( "beginLine" ) . get ( token ) ; int beginColumn = ( Integer ) token . getClass ( ) . getDeclaredField ( "beginColumn" ) . get ( token ) ; int endLine = ( Integer ) token . getClass ( ) . getDeclaredField ( "endLine" ) . get ( token ) ; int endColumn = ( Integer ) token . getClass ( ) . getDeclaredField ( "endColumn" ) . get ( token ) ; return new CodePosition ( beginLine , beginColumn , endLine , endColumn ) ; } catch ( IllegalAccessException | NoSuchFieldException e ) { throw new RuntimeException ( e ) ; } }
inputData is expected to be a Token type automatically generated by JavaCC
 when a JavaCC grammar is evaluated into a lexer and a parser.
inputData is expected to be a Token type automatically generated by JavaCC when a JavaCC grammar is evaluated into a lexer and a parser .