示例#1
0
        public MibModule(string name, Lexer lexer)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (lexer == null)
            {
                throw new ArgumentNullException("lexer");
            }

            _name = name.ToUpperInvariant(); // all module name are uppercase.
            Symbol temp = lexer.NextNonEOLSymbol;

            temp.Expect(Symbol.Definitions);
            temp = lexer.NextNonEOLSymbol;
            temp.Expect(Symbol.Assign);
            temp = lexer.NextSymbol;
            temp.Expect(Symbol.Begin);
            temp = lexer.NextNonEOLSymbol;
            if (temp == Symbol.Imports)
            {
                _imports = ParseDependents(lexer);
            }
            else if (temp == Symbol.Exports)
            {
                _exports = ParseExports(lexer);
            }

            ParseEntities(_tokens, temp, _name, lexer);
        }
示例#2
0
        public MibModule(string name, Lexer lexer)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            
            if (lexer == null)
            {
                throw new ArgumentNullException("lexer");
            }
            
            _name = name.ToUpperInvariant(); // all module name are uppercase.
            Symbol temp = lexer.GetNextNonEOLSymbol();
            temp.Expect(Symbol.Definitions);
            temp = lexer.GetNextNonEOLSymbol();
            temp.Expect(Symbol.Assign);
            temp = lexer.GetNextSymbol();
            temp.Expect(Symbol.Begin);
            temp = lexer.GetNextNonEOLSymbol();
            if (temp == Symbol.Imports)
            {
                _imports = ParseDependents(lexer);
            }
            else if (temp == Symbol.Exports)
            {
                _exports = ParseExports(lexer);
            }
            else if (temp == Symbol.End)
            {
                return;
            }

            ParseEntities(_tokens, temp, _name, lexer);
        }
示例#3
0
        public MibModule(ISymbolEnumerator symbols)
        {
            if (symbols == null)
            {
                throw new ArgumentNullException("lexer");
            }

            Symbol temp = symbols.NextNonEOLSymbol();

            temp.AssertIsValidIdentifier();
            _name = temp.ToString().ToUpperInvariant(); // all module names are uppercase

            temp = symbols.NextNonEOLSymbol();
            temp.Expect(Symbol.Definitions);

            temp = symbols.NextNonEOLSymbol();
            temp.Expect(Symbol.Assign);

            temp = symbols.NextSymbol();
            temp.Expect(Symbol.Begin);

            temp = symbols.NextNonEOLSymbol();
            if (temp == Symbol.Imports)
            {
                _imports = ParseDependents(symbols);
            }
            else if (temp == Symbol.Exports)
            {
                _exports = ParseExports(symbols);
            }
            else
            {
                symbols.PutBack(temp);
            }

            ParseEntities(symbols);
        }