Ejemplo n.º 1
0
 public static SourceSpan FromIrony(Irony.Parsing.SourceSpan span, string source)
 {
     return(new SourceSpan(
                FromIrony(span.Location, source),
                new SourceLocation(span.Location.Line, span.Location.Column + span.Length, span.EndPosition, source)
                ));
 }
Ejemplo n.º 2
0
        private void SetSelectionIfSelected(SourceSpan span, XMLLuaSearchElement elem)
        {
            if (elem.Select)
            {
                if (SelectedSpan != null)
                {
                    throw new Exception("Cannot select more than one AST element!");
                }

                SelectedSpan    = span;
                SelectedElement = elem;
            }
        }
Ejemplo n.º 3
0
 public static SourceSpan Convert(Irony.Parsing.SourceSpan sourceSpan)
 {
     return(new SourceSpan(Convert(sourceSpan.Location), sourceSpan.Length));
 }
Ejemplo n.º 4
0
        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            headerSpan = new Irony.Parsing.SourceSpan(this.Span.Location,
                treeNode.ChildNodes[2].Span.EndPosition - this.Span.Location.Position);

            AddChild("Block", treeNode.ChildNodes[4]);

            foreach (var parameter in treeNode.ChildNodes[2].ChildNodes)
            {
                var name = parameter.ChildNodes[0].FindTokenAndGetText();
                var type = parameter.ChildNodes[1].FindTokenAndGetText();
                parameters.Add(new Tuple<string, string>(name, type));
            }
            function = new Model.Function();
            function.name = treeNode.ChildNodes[1].FindTokenAndGetText();
            function.Node = this;
            function.parameterCount = parameters.Count;
            function.localScope = new Model.Scope();
            function.localScope.type = Model.ScopeType.Function;
            function.localScope.activeFunction = this;
            function.returnType = treeNode.ChildNodes[3].FindTokenAndGetText();
            if (function.returnType == null) function.returnType = "word";
            ResultType = function.returnType;
        }