/// <summary> /// Browse through the Term to find the value to edit /// </summary> /// <param name="term"></param> private void VisitTerm(Term term) { if (term.LiteralValue != null) { term.LiteralValue = EditExpression(term.LiteralValue); } }
/// <summary> /// Visits a term /// </summary> /// <param name="term"></param> protected virtual void VisitTerm(Term term) { if (term != null) { if (term.Designator != null) { VisitDesignator(term.Designator); } if (term.LiteralValue != null) { VisitExpression(term.LiteralValue); } } }
/// <summary> /// Constructor /// </summary> /// <param name="root">The root for which this expression should be evaluated</param> /// <param name="log"></param> /// <param name="term"></param> /// <param name="parsingData">Additional information about the parsing process</param> public UnaryExpression(ModelElement root, ModelElement log, Term term, ParsingData parsingData) : base(root, log, parsingData) { Term = SetEnclosed(term); }
/// <summary> /// Creates a redef expression based on the input of the parser /// </summary> /// <returns></returns> private Expression DerefExpression() { Expression retVal = null; List<Expression> derefArguments = new List<Expression>(); SkipWhiteSpaces(); int start = Index; string id = Identifier(); while (id != null) { Designator designator = new Designator(Root, RootLog, id, start, start + id.Length); Term term = new Term(Root, RootLog, designator, designator.Start, designator.End); UnaryExpression unaryExpression = new UnaryExpression(Root, RootLog, term, term.Start, term.End); derefArguments.Add(unaryExpression); id = null; if (LookAhead(".")) { Match("."); SkipWhiteSpaces(); start = Index; id = Identifier(); } } if (derefArguments.Count == 1) { retVal = derefArguments[0]; } else if (derefArguments.Count > 1) { retVal = new DerefExpression(Root, RootLog, derefArguments, derefArguments[0].Start, derefArguments[derefArguments.Count - 1].End); } return retVal; }
/// <summary> /// Constructor /// </summary> /// <param name="root">The root for which this expression should be evaluated</param> /// <param name="term"></parparam> public UnaryExpression(ModelElement root, Term term) : base(root) { Term = term; Term.Enclosing = this; }
/// <summary> /// Provides the Term at position Index of the Buffer. /// </summary> /// <returns></returns> public Term Term() { Term retVal = null; Expression literalValue = EvaluateLiteral(); if (literalValue != null) { retVal = new Term(Root, RootLog, literalValue, literalValue.Start, literalValue.End); } if (retVal == null) { Designator designator = Designator(); if (designator != null) { retVal = new Term(Root, RootLog, designator, designator.Start, designator.End); } } return retVal; }
/// <summary> /// Creates a redef expression based on the input of the parser /// </summary> /// <returns></returns> private Expression DerefExpression() { Expression retVal = null; List<Expression> derefArguments = new List<Expression>(); string id = Identifier(); while (id != null) { Designator designator = new Interpreter.Designator(Root, id); Term term = new Term(Root, designator); UnaryExpression unaryExpression = new UnaryExpression(Root, term); derefArguments.Add(unaryExpression); id = null; if (LookAhead(".")) { Match("."); id = Identifier(); } } if (derefArguments.Count == 1) { retVal = derefArguments[0]; } else if (derefArguments.Count > 1) { retVal = new DerefExpression(Root, derefArguments); } return retVal; }
/// <summary> /// Constructor /// </summary> /// <param name="root">The root for which this expression should be evaluated</param> /// <param name="term"></parparam> /// <param name="start">The start character for this expression in the original string</param> /// <param name="end">The end character for this expression in the original string</param> public UnaryExpression(ModelElement root, ModelElement log, Term term, int start, int end) : base(root, log, start, end) { Term = term; Term.Enclosing = this; }
/// <summary> /// Visits a term /// </summary> /// <param name="term"></param> protected virtual void VisitTerm(Term term) { if (term != null) { if (term.Designator != null) { VisitInterpreterTreeNode(term.Designator); } if (term.LiteralValue != null) { VisitInterpreterTreeNode(term.LiteralValue); } } }
/// <summary> /// Constructor /// </summary> /// <param name="root">The root for which this expression should be evaluated</param> /// <param name="log"></param> /// <param name="term"></param> /// <param name="start">The start character for this expression in the original string</param> /// <param name="end">The end character for this expression in the original string</param> public UnaryExpression(ModelElement root, ModelElement log, Term term, int start, int end) : base(root, log, start, end) { Term = SetEnclosed(term); }