Exemplo n.º 1
0
        public override void Load()
        {
            if (alreadyLoaded)
            {
                return;
            }

            alreadyLoaded = true;
            GroupParser parser = null;

            try
            {
                ANTLRStringStream fs = new ANTLRStringStream(text);
                fs.name = sourceName;
                GroupLexer        lexer  = new GroupLexer(fs);
                CommonTokenStream tokens = new CommonTokenStream(lexer);
                parser = new GroupParser(tokens);
                // no prefix since this group file is the entire group, nothing lives
                // beneath it.
                parser.group(this, "/");
            }
            catch (Exception e)
            {
                ErrorManager.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, "<string>");
            }
        }
Exemplo n.º 2
0
        /** Load a group file with full path fileName; it's relative to root by prefix. */
        public virtual void LoadGroupFile(string prefix, string fileName)
        {
            //System.out.println("load group file prefix="+prefix+", fileName="+fileName);
            GroupParser parser = null;

            try
            {
                Uri f = new Uri(fileName);
                ANTLRReaderStream fs    = new ANTLRReaderStream(new System.IO.StreamReader(f.LocalPath, Encoding ?? Encoding.UTF8));
                GroupLexer        lexer = new GroupLexer(fs);
                fs.name = fileName;
                CommonTokenStream tokens = new CommonTokenStream(lexer);
                parser = new GroupParser(tokens);
                parser.group(this, prefix);
            }
            catch (Exception e)
            {
                ErrorManager.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, fileName);
            }
        }