Class ParserDataPackage

java.lang.Object
cruise.umple.parser.analysis.ParserDataPackage

public class ParserDataPackage
extends java.lang.Object
ParserDataPackage is a structure which contains all the miscellaneous data during the parse. Most importantly it contains the linenumbers, which are the linenumbers associated to the character numbers(or offsets) of a given \n. And couples which are initialized to be the character position of the open and close of those couples, for example there is a couple for { and } which will matched {a {b }c }d 'a' with 'd' and 'b' with 'c'
  • Constructor Summary

    Constructors 
    Constructor Description
    ParserDataPackage​(java.lang.String aFilename, GrammarAnalyzer aAnalyzer)  
  • Method Summary

    Modifier and Type Method Description
    boolean addLine​(java.lang.String aLine)  
    void delete()  
    GrammarAnalyzer getAnalyzer()  
    java.util.HashMap<java.lang.String,​ParsingCouple> getCouples()
    Associated to each key is a couple
    java.lang.String getFilename()
    the filename of the file that is being parsed
    java.lang.String getFullFileAddress()
    This is used to save the full address of the fileName.
    int getFurthestGotten()
    for comparing the furthest position attained during the parse, represents the highest offset seen by this parserdatapackage object
    java.util.List<java.lang.String> getHasParsed()
    List of filenames that have already been parsed
    java.lang.String getInput()
    the string that is the file that is being parsed
    java.util.HashMap<java.lang.String,​java.lang.String[]> getKeys()
    They keys for the different couples {} for example
    java.lang.String getLine​(int index)  
    java.util.LinkedHashMap<java.lang.Integer,​java.lang.Integer> getLinenumbers()
    a hashmap where the key represent the offset and the value represents the line number at that offset
    java.lang.String[] getLines()  
    boolean getNoSpaces()
    carries the context of the "no spaces" rule
    ParseResult getParseResult()
    for passing around errors
    Position getPosition()
    keeps track of the furthest token position attained during the parse.
    int getPreviousFurthest()
    for comparing the furthest position attained during the parse, represents the second highest offset seen by this parserdatapackage object
    boolean hasLines()  
    int indexOfLine​(java.lang.String aLine)  
    void init​(Position usePosition)
    The passed Position can be null if this method was not invoked using a useStatement.
    void init​(java.lang.String rawinput, Position usePosition, int linenumber, int offset)  
    boolean isNoSpaces()  
    void linkFiles​(LinkedFileHandler handler, java.io.File[] linkedFiles)
    Links files together at compile-time, provided a handler and the filenames.
    int numberOfLines()  
    boolean removeLine​(java.lang.String aLine)  
    boolean setAnalyzer​(GrammarAnalyzer aAnalyzer)  
    boolean setCouples​(java.util.HashMap<java.lang.String,​ParsingCouple> aCouples)  
    boolean setFilename​(java.lang.String aFilename)  
    boolean setFullFileAddress​(java.lang.String aFullFileAddress)  
    boolean setFurthestGotten​(int aFurthestGotten)  
    boolean setHasParsed​(java.util.List<java.lang.String> aHasParsed)  
    boolean setInput​(java.lang.String aInput)  
    boolean setKeys​(java.util.HashMap<java.lang.String,​java.lang.String[]> aKeys)  
    boolean setLinenumbers​(java.util.LinkedHashMap<java.lang.Integer,​java.lang.Integer> aLinenumbers)  
    boolean setNoSpaces​(boolean aNoSpaces)  
    boolean setParseResult​(ParseResult aParseResult)  
    boolean setPosition​(Position aPosition)  
    boolean setPreviousFurthest​(int aPreviousFurthest)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • setFilename

      public boolean setFilename​(java.lang.String aFilename)
    • setFullFileAddress

      public boolean setFullFileAddress​(java.lang.String aFullFileAddress)
    • setAnalyzer

      public boolean setAnalyzer​(GrammarAnalyzer aAnalyzer)
    • setInput

      public boolean setInput​(java.lang.String aInput)
    • setFurthestGotten

      public boolean setFurthestGotten​(int aFurthestGotten)
    • setPreviousFurthest

      public boolean setPreviousFurthest​(int aPreviousFurthest)
    • setParseResult

      public boolean setParseResult​(ParseResult aParseResult)
    • setPosition

      public boolean setPosition​(Position aPosition)
    • setCouples

      public boolean setCouples​(java.util.HashMap<java.lang.String,​ParsingCouple> aCouples)
    • setLinenumbers

      public boolean setLinenumbers​(java.util.LinkedHashMap<java.lang.Integer,​java.lang.Integer> aLinenumbers)
    • setHasParsed

      public boolean setHasParsed​(java.util.List<java.lang.String> aHasParsed)
    • setKeys

      public boolean setKeys​(java.util.HashMap<java.lang.String,​java.lang.String[]> aKeys)
    • addLine

      public boolean addLine​(java.lang.String aLine)
    • removeLine

      public boolean removeLine​(java.lang.String aLine)
    • setNoSpaces

      public boolean setNoSpaces​(boolean aNoSpaces)
    • getFilename

      public java.lang.String getFilename()
      the filename of the file that is being parsed
    • getFullFileAddress

      public java.lang.String getFullFileAddress()
      This is used to save the full address of the fileName.
    • getAnalyzer

      public GrammarAnalyzer getAnalyzer()
    • getInput

      public java.lang.String getInput()
      the string that is the file that is being parsed
    • getFurthestGotten

      public int getFurthestGotten()
      for comparing the furthest position attained during the parse, represents the highest offset seen by this parserdatapackage object
    • getPreviousFurthest

      public int getPreviousFurthest()
      for comparing the furthest position attained during the parse, represents the second highest offset seen by this parserdatapackage object
    • getParseResult

      public ParseResult getParseResult()
      for passing around errors
    • getPosition

      public Position getPosition()
      keeps track of the furthest token position attained during the parse.
    • getCouples

      public java.util.HashMap<java.lang.String,​ParsingCouple> getCouples()
      Associated to each key is a couple
    • getLinenumbers

      public java.util.LinkedHashMap<java.lang.Integer,​java.lang.Integer> getLinenumbers()
      a hashmap where the key represent the offset and the value represents the line number at that offset
    • getHasParsed

      public java.util.List<java.lang.String> getHasParsed()
      List of filenames that have already been parsed
    • getKeys

      public java.util.HashMap<java.lang.String,​java.lang.String[]> getKeys()
      They keys for the different couples {} for example
    • getLine

      public java.lang.String getLine​(int index)
    • getLines

      public java.lang.String[] getLines()
    • numberOfLines

      public int numberOfLines()
    • hasLines

      public boolean hasLines()
    • indexOfLine

      public int indexOfLine​(java.lang.String aLine)
    • getNoSpaces

      public boolean getNoSpaces()
      carries the context of the "no spaces" rule
    • isNoSpaces

      public boolean isNoSpaces()
    • delete

      public void delete()
    • init

      public void init​(Position usePosition)
      The passed Position can be null if this method was not invoked using a useStatement. It takes a file and reads it, it also initializes the couples which will be used for this file.
    • linkFiles

      public void linkFiles​(LinkedFileHandler handler, java.io.File[] linkedFiles)
      Links files together at compile-time, provided a handler and the filenames. Note: This has no effect if the handler is null
    • init

      public void init​(java.lang.String rawinput, Position usePosition, int linenumber, int offset)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object