Beispiel #1
0
 protected string PrintTokenPaths(IList <int[]> paths)
 {
     return(paths.Join("\n", arr => {
         Context.Entry e = null;
         Token t = GetTokenAt(tokens, arr, ref e);
         return arr.Join(", ") + ":" + t + " @" + ParseError.FilePositionOf(t, rows);
     }));
 }
Beispiel #2
0
        public string FilePositionOf(Token token)
        {
            List <Context.Entry> traversed = new List <Context.Entry>();

            while (!token.IsValid)
            {
                Context.Entry e = token.GetAsContextEntry();
                if (e == null || traversed.IndexOf(e) >= 0)
                {
                    return("???");
                }
                traversed.Add(e);
                token = e.tokens[0];
            }
            return(ParseError.FilePositionOf(token, rows));
        }
Beispiel #3
0
        public string FilePositionOf(Token token)
        {
            List <SyntaxTree> traversed = new List <SyntaxTree>();

            while (!token.IsValid)
            {
                SyntaxTree e = token.GetAsSyntaxNode();
                if (e == null || traversed.IndexOf(e) >= 0)
                {
                    return("???");
                }
                traversed.Add(e);
                token = e.tokens[0];
            }
            return(ParseError.FilePositionOf(token, rows));
        }
Beispiel #4
0
 public void FilePositionOf(Token token, out int row, out int col)
 {
     ParseError.FilePositionOf(token, rows, out row, out col);
 }