Package net.ssehub.easy.dslCore
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>
Specific "parser" that identifies a position where to cut the headers from the content.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate InputStreamprivate intprivate intprivate intprivate StringBuilderprivate intprivate ModelUtility.Rule[]private ModelUtility.ParseState -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCutLeadInParser(InputStream in, ModelUtility.Rule... rules) Creates a parser instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidanalyze()Analyze a token/constant/value/keyword.private static booleanenableAnalysis(char ch) Enables token/symbol analysis, i.e., are we at a meaningful separator (in CODE).private ModelUtility.ParseStatehandleOut(char ch, ModelUtility.ParseState nextState) Handles fixing or appending toout.private voidMatches the rules.private Stringparse()Parse the text and cut it.private ModelUtility.ParseStatereset(int pos) Resets the parser for a new top-level unit.
-
Field Details
-
in
-
out
-
rules
-
state
-
lastStart
private int lastStart -
lastEndMatch
private int lastEndMatch -
ruleIndex
private int ruleIndex -
parts
-
nestingLevel
private int nestingLevel -
emit
private boolean emit
-
-
Constructor Details
-
CutLeadInParser
Creates a parser instance.- Parameters:
in- the input stream to analyze/cutrules- the rules
-
-
Method Details
-
parse
Parse the text and cut it.- Returns:
- the inital or modified text
- Throws:
IOException- if reading a character fails
-
reset
Resets the parser for a new top-level unit.- Parameters:
pos- the next position oflastStartandlastEndMatch.- Returns:
- the next state
-
handleOut
Handles fixing or appending toout.- Parameters:
ch- the actual characternextState- the next state- Returns:
nextState
-
enableAnalysis
private static boolean enableAnalysis(char ch) Enables token/symbol analysis, i.e., are we at a meaningful separator (in CODE).- Parameters:
ch- the actual character- Returns:
truefor enable analysis,falseelse
-
analyze
private void analyze()Analyze a token/constant/value/keyword. -
matchRules
private void matchRules()Matches the rules.
-