Class ParserUtils

java.lang.Object
edu.unc.cs.comp524.parsers.prolog.ParserUtils

public class ParserUtils
extends Object
Static utilities for the package
  • Constructor Summary

    Constructors 
    Constructor Description
    ParserUtils()  
  • Method Summary

    Modifier and Type Method Description
    static int countLines​(org.antlr.v4.runtime.Token t)
    The number of lines in a token's Token.getText().
    static org.antlr.v4.runtime.tree.pattern.ParseTreePattern factPattern​(PrologParser parser)
    A ParseTreePattern that matches fact definitions.
    static org.antlr.v4.runtime.tree.pattern.ParseTreePattern invocationPattern​(PrologParser parser)
    A ParseTreePattern that matches rule invocations.
    static <T> List<T> join​(List<T>... lists)
    Concatentates all of the lists.
    static org.antlr.v4.runtime.tree.pattern.ParseTreePattern rule0Pattern​(PrologParser parser)
    A ParseTreePattern that matches rule definitions with no arguments.
    static org.antlr.v4.runtime.tree.pattern.ParseTreePattern rulePattern​(PrologParser parser)
    A ParseTreePattern that matches rule definitions.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • factPattern

      public static final org.antlr.v4.runtime.tree.pattern.ParseTreePattern factPattern​(PrologParser parser)
      A ParseTreePattern that matches fact definitions.
    • rulePattern

      public static final org.antlr.v4.runtime.tree.pattern.ParseTreePattern rulePattern​(PrologParser parser)
      A ParseTreePattern that matches rule definitions.
    • rule0Pattern

      public static final org.antlr.v4.runtime.tree.pattern.ParseTreePattern rule0Pattern​(PrologParser parser)
      A ParseTreePattern that matches rule definitions with no arguments.
    • invocationPattern

      public static final org.antlr.v4.runtime.tree.pattern.ParseTreePattern invocationPattern​(PrologParser parser)
      A ParseTreePattern that matches rule invocations.
    • countLines

      public static int countLines​(org.antlr.v4.runtime.Token t)
      The number of lines in a token's Token.getText().
    • join

      public static <T> List<T> join​(List<T>... lists)
      Concatentates all of the lists.

      Would be written as join = reduce (++) [] in pseudo-Haskell