Exemplo n.º 1
0
        private static Syntax ParseVector(Token thisToken, Tokenizer moreTokens)
        {
            var   listContents = new ListSyntax( );
            Token dotToken     = null;

            var nextToken = moreTokens.ReadToken();

            while (nextToken != null && nextToken.type != TokenType.CloseBracket)
            {
                // Parse this token
                listContents.Add(ParseToken(nextToken, moreTokens));

                // Fetch the next token
                nextToken = moreTokens.ReadToken();
                if (nextToken == null)
                {
                    throw ParserError.SyntaxError("parser", "Improperly formed list.", dotToken);
                }

                //if (!improper && nextToken.Type == TokenType.Symbol && dotSymbol.Equals(nextToken.Value) && thisToken.Type == TokenType.OpenBracket)
                if (nextToken.type == TokenType.Dot)
                {
                    throw ParserError.SyntaxError("parser", "Improperly formed dotted list", nextToken);
                }
            }

            if (nextToken == null) // Missing ')'
            {
                throw ParserError.SyntaxError("parser", "Missing close parenthesis", thisToken);
            }

            return(Syntax.Create(listContents, thisToken.location));
        }
Exemplo n.º 2
0
 public SyntaxVector(ListSyntax value, Location location = null) : base(location)
 {
     UnityEngine.Debug.Assert(value != null);
     asList = value != null ? value : new ListSyntax( );
 }
Exemplo n.º 3
0
 public static SyntaxVector Create(ListSyntax value, Location location = null)
 {
     return(new SyntaxVector(value, location));
 }