Ejemplo n.º 1
0
 /// <summary>
 /// Returns true if name is a C# keyword
 /// </summary>
 public TokenType IsKeyword(Name name) {
     object o = _keywords[name];
     if (o != null) {
         return (TokenType)o;
     }
     return TokenType.Invalid;
 }
Ejemplo n.º 2
0
        public PreprocessorTokenType IsKeyword(Name value) {
            object o = keywords[value];
            if (o != null) {
                return (PreprocessorTokenType)o;
            }

            return PreprocessorTokenType.Invalid;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates or returns the Name for a string.
 /// </summary>
 public Name Add(string value) {
     Name name = Find(value);
     if (name == null) {
         name = new Name(value);
         _values.Add(name, name);
     }
     return name;
 }
Ejemplo n.º 4
0
        public Parser(NameTable symbolTable, string path) {
            this.symbolTable = symbolTable;
            _path = path;

            assemblyName = symbolTable.Add("assembly");
            moduleName = symbolTable.Add("module");
            unknownName = symbolTable.Add("__unknown");
            getName = symbolTable.Add("get");
            setName = symbolTable.Add("set");
            addName = symbolTable.Add("add");
            removeName = symbolTable.Add("remove");
            partialName = symbolTable.Add("partial");
            yieldName = symbolTable.Add("yield");
            whereName = symbolTable.Add("where");
            aliasName = symbolTable.Add("alias");
        }
Ejemplo n.º 5
0
 internal IdentifierToken(Name identifier, bool atPrefixed, string sourcePath, BufferPosition position)
     : base(TokenType.Identifier, sourcePath, position) {
     _symbol = identifier;
     _atPrefixed = atPrefixed;
 }
 public PreprocessorIdentifierToken(Name value, BufferPosition position)
     : base(PreprocessorTokenType.Identifier, position)
 {
     _value = value;
 }
Ejemplo n.º 7
0
 private IdentifierToken EatContextualKeyword(Name contextualKeyword) {
     IdentifierToken token = (IdentifierToken)Eat(TokenType.Identifier);
     Debug.Assert(token.Symbol == contextualKeyword);
     return token;
 }
Ejemplo n.º 8
0
 private bool PeekContextualKeyword(Name contextualKeyword) {
     return PeekType() == TokenType.Identifier && ((IdentifierToken)PeekToken()).Symbol == contextualKeyword;
 }
 public PreprocessorDeclarationLine(PreprocessorTokenType type, Name identifier)
     : base(type) {
     _identifier = identifier;
 }