Class ParserUtil


  • public final class ParserUtil
    extends java.lang.Object
    Contains utility methods for parser to use while creating ast.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String BLOCK_MULTIPLE_COMMENT_BEGIN
      Symbols with which multiple comment starts.
      private static java.lang.String BLOCK_MULTIPLE_COMMENT_END
      Symbols with which multiple comment ends.
      private static java.lang.String JAVADOC_START
      Symbols with which javadoc starts.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ParserUtil()
      Stop instances being created.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.util.Map.Entry<java.lang.Integer,​java.lang.Integer> countLinesColumns​(java.lang.String text, int initialLinesCnt, int initialColumnsCnt)
      Count lines and columns (in last line) in text.
      static DetailAST createBlockCommentNode​(java.lang.String content)
      Create block comment from string content.
      static DetailAST createBlockCommentNode​(org.antlr.v4.runtime.CommonToken token)
      Create block comment from token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParserUtil

        private ParserUtil()
        Stop instances being created.
    • Method Detail

      • createBlockCommentNode

        public static DetailAST createBlockCommentNode​(java.lang.String content)
        Create block comment from string content.
        Parameters:
        content - comment content.
        Returns:
        DetailAST block comment
      • createBlockCommentNode

        public static DetailAST createBlockCommentNode​(org.antlr.v4.runtime.CommonToken token)
        Create block comment from token.
        Parameters:
        token - Token object.
        Returns:
        DetailAST with BLOCK_COMMENT type.
      • countLinesColumns

        private static java.util.Map.Entry<java.lang.Integer,​java.lang.Integer> countLinesColumns​(java.lang.String text,
                                                                                                        int initialLinesCnt,
                                                                                                        int initialColumnsCnt)
        Count lines and columns (in last line) in text.
        Parameters:
        text - String.
        initialLinesCnt - initial value of lines counter.
        initialColumnsCnt - initial value of columns counter.
        Returns:
        entry(pair), key is line counter, value is column counter.