public AutomationErrorNode(ITokenStream input, IToken start, IToken stop, RecognitionException ex) { var handler = new CommonErrorNode(input, start, stop, ex); this.isNil = handler.IsNil; this.type = handler.Type; this.text = handler.Text; this.toString = handler.ToString(); }
/** * Constructor. * * @param pInput Will be passed to the constructor of the wrapped object. * @param pStart Will be passed to the constructor of the wrapped object. * @param pStop Will be passed to the constructor of the wrapped object. * @param pException Will be passed to the constructor of the wrapped * object. * * __TEST__ */ public AST2JSOMCommonErrorNode( ITokenStream pInput, IToken pStart, IToken pStop, RecognitionException pException) : base() { //base(); mCommonErrorNode = new CommonErrorNode(pInput, pStart, pStop, pException); }
public virtual void HandleError(Node offendingNode, Error error, params string[] messageParameters) { if (offendingNode == null || offendingNode.IsErroneous) { return; } if (offendingNode is Literal && offendingNode.SourceContext.Document == null) { return; } CommonErrorNode enode = new CommonErrorNode(error, messageParameters); enode.SourceContext = offendingNode.SourceContext; if (enode.Severity == 0) { offendingNode.IsErroneous = true; } this.Errors.Add(enode); }
public void ParseBlock(CommonTree tree) { if (tree is CommonErrorNode) { CommonErrorNode commonErrorNode = (CommonErrorNode)tree; throw new Exception($"Failed to parse block! Line {commonErrorNode.stop.Line - 1}:{commonErrorNode.stop.CharPositionInLine}\nException: {commonErrorNode.trappedException}"); } if (tree.Token.Text != "BLOCK") { throw new Exception($"Line {tree.Line}: Expected token type BLOCK (function declaration), got token {tree.Token.Text}"); } string text = tree.Children[0].Text; if (blockList.ContainsKey(text)) { throw new Exception($"Line {tree.Line}: Function name '{text}' already previously declared."); } blockList.Add(text, (int)Mstream.Position); OutputTree(tree, 1); Cmd_LineNum(0); Cmd_Return(); }
public LSLErrorNode(ITokenStream input, IToken start, IToken stop, RecognitionException e) { _delegate = new CommonErrorNode(input, start, stop, e); }
public virtual void HandleError(Node offendingNode, Error error, params string[] messageParameters){ if (offendingNode == null || offendingNode.IsErroneous) return; if (offendingNode is Literal && offendingNode.SourceContext.Document == null) return; CommonErrorNode enode = new CommonErrorNode(error, messageParameters); enode.SourceContext = offendingNode.SourceContext; if (enode.Severity == 0) offendingNode.IsErroneous = true; this.Errors.Add(enode); }
public virtual ErrorNode CreateErrorNode(Error error, Method method){ ErrorNode result = new CommonErrorNode(error); result.MessageParameters = new string[]{method.FullName}; result.SourceContext = method.Name.SourceContext; return result; }