Class ParsingCouple

java.lang.Object
cruise.umple.parser.rules.ParsingCouple

public class ParsingCouple
extends java.lang.Object
ParsingCouples are used by balanced rules to quickly find the corresponding brace. They are initialized at the begining of each file parsed and are stored in the ParserDataPackage. They contain the character positions of each open brace and each close brace(when braces are the key) so {{}} would have positionFrom = {1,2} and positionTo = {4,3}
  • Field Details

  • Constructor Details

    • ParsingCouple

      public ParsingCouple​(java.lang.String aOpen, java.lang.String aClose)
  • Method Details

    • setOpen

      public boolean setOpen​(java.lang.String aOpen)
    • setClose

      public boolean setClose​(java.lang.String aClose)
    • addPositionFrom

      public boolean addPositionFrom​(java.lang.Integer aPositionFrom)
    • removePositionFrom

      public boolean removePositionFrom​(java.lang.Integer aPositionFrom)
    • addPositionTo

      public boolean addPositionTo​(java.lang.Integer aPositionTo)
    • removePositionTo

      public boolean removePositionTo​(java.lang.Integer aPositionTo)
    • getOpen

      public java.lang.String getOpen()
      The open key, a close brace or quote for example
    • getClose

      public java.lang.String getClose()
      The close key, a close brace or quote for example
    • getPositionFrom

      public java.lang.Integer getPositionFrom​(int index)
    • getPositionFrom

      public java.lang.Integer[] getPositionFrom()
    • numberOfPositionFrom

      public int numberOfPositionFrom()
    • hasPositionFrom

      public boolean hasPositionFrom()
    • indexOfPositionFrom

      public int indexOfPositionFrom​(java.lang.Integer aPositionFrom)
    • getPositionTo

      public java.lang.Integer getPositionTo​(int index)
    • getPositionTo

      public java.lang.Integer[] getPositionTo()
    • numberOfPositionTo

      public int numberOfPositionTo()
    • hasPositionTo

      public boolean hasPositionTo()
    • indexOfPositionTo

      public int indexOfPositionTo​(java.lang.Integer aPositionTo)
    • delete

      public void delete()
    • init

      public ParsingCouple init​(java.lang.String input)
      Searches the input string for the key this couple protects. If a key is found with a \ before it, it is not considered if a key is found between // and \n it is not considered if a key is found within " and " it is not considered if a key is found between ' and ' it is not considered if ever there is a need for say "\{" to happen, i.e. that \ is terminal followed by { code } or something like that then this function will need to be revised so that there can be conditional escaping(it would probably just be an attribute of the couple) future plans also include refactoring this function so that all the couples are found on one pass through the input instead of having to re-initialize on every new input The ignore level comes into play for instance if you have /*lvl0 /*lvl1 and you only want to hide lvl1 you would put the ignore level as 1
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

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