Class ModelUtility.CutLeadInParser

java.lang.Object
net.ssehub.easy.dslCore.ModelUtility.CutLeadInParser
Enclosing class:
ModelUtility<E extends org.eclipse.emf.ecore.EObject,R extends net.ssehub.easy.basics.modelManagement.IModel>

private static class ModelUtility.CutLeadInParser extends Object
Specific "parser" that identifies a position where to cut the headers from the content.
Author:
Holger Eichelberger
  • Field Details

    • in

      private InputStream in
    • out

      private StringBuilder out
    • rules

      private ModelUtility.Rule[] rules
    • state

      private ModelUtility.ParseState state
    • lastStart

      private int lastStart
    • lastEndMatch

      private int lastEndMatch
    • ruleIndex

      private int ruleIndex
    • parts

      private List<String> parts
    • nestingLevel

      private int nestingLevel
    • parLevel

      private int parLevel
    • emit

      private boolean emit
  • Constructor Details

    • CutLeadInParser

      private CutLeadInParser(InputStream in, ModelUtility.Rule... rules)
      Creates a parser instance.
      Parameters:
      in - the input stream to analyze/cut
      rules - the rules
  • Method Details

    • handleEscape

      private ModelUtility.ParseState handleEscape(ModelUtility.ParseState state)
      Handles the state transitions for an escape character.
      Parameters:
      state - the actual state
      Returns:
      the next state, may be state
    • handleStringStart

      private ModelUtility.ParseState handleStringStart(ModelUtility.ParseState stringState, ModelUtility.ParseState state, ModelUtility.ParseState nextState)
      Handles the state transitions when a string starts.
      Parameters:
      stringState - the state representing the string
      state - the actual state
      nextState - the next state to become active with the next character
      Returns:
      the next state, may be nextState
    • handleAsterisk

      private ModelUtility.ParseState handleAsterisk(ModelUtility.ParseState state, ModelUtility.ParseState nextState)
      Handles the state transitions when an asterisk is found.
      Parameters:
      state - the actual state
      nextState - the next state to become active with the next character
      Returns:
      the next state, may be nextState
    • handleSlash

      Handles the state transitions when a slash is found.
      Parameters:
      state - the actual state
      nextState - the next state to become active with the next character
      Returns:
      the next state, may be nextState
    • handleBackSlash

      private ModelUtility.ParseState handleBackSlash(ModelUtility.ParseState state, ModelUtility.ParseState nextState)
      Handles the state transitions when a backslash is found.
      Parameters:
      state - the actual state
      nextState - the next state to become active with the next character
      Returns:
      the next state, may be nextState
    • parse

      private String parse() throws IOException
      Parse the text and cut it.
      Returns:
      the inital or modified text
      Throws:
      IOException - if reading a character fails
    • reset

      private ModelUtility.ParseState reset(int pos)
      Resets the parser for a new top-level unit.
      Parameters:
      pos - the next position of lastStart and lastEndMatch.
      Returns:
      the next state
    • handleOut

      private ModelUtility.ParseState handleOut(char ch, ModelUtility.ParseState nextState)
      Handles fixing or appending to out.
      Parameters:
      ch - the actual character
      nextState - the next state
      Returns:
      nextState
    • enableAnalysis

      private boolean enableAnalysis(char ch)
      Enables token/symbol analysis, i.e., are we at a meaningful separator (in CODE).
      Parameters:
      ch - the actual character
      Returns:
      true for enable analysis, false else
    • analyze

      private void analyze()
      Analyze a token/constant/value/keyword.
    • matchRules

      private void matchRules()
      Matches the rules.