• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICharStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICharStream的典型用法代码示例。如果您正苦于以下问题:C# ICharStream类的具体用法?C# ICharStream怎么用?C# ICharStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICharStream类属于命名空间,在下文中一共展示了ICharStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MatlabLexer

        public MatlabLexer(ICharStream input, Configuration configuration)
            : this(input)
        {
            Checker.CheckNotNull(configuration);

            this.Configuration = configuration;
        }
开发者ID:samuel-suffos,项目名称:matlab-parser,代码行数:7,代码来源:MatlabLexer.cs


示例2: FuncProtoToShimLexer

	public FuncProtoToShimLexer(ICharStream input, RecognizerSharedState state)
		: base(input, state)
	{


		OnCreated();
	}
开发者ID:emperorstarfinder,项目名称:phlox,代码行数:7,代码来源:FuncProtoToShimLexer.cs


示例3: Compile

        public void Compile(ICharStream input)
        {
            try
            {
                AssemblerLexer lex = new AssemblerLexer(input);
                CommonTokenStream tokens = new CommonTokenStream(lex);
                AssemblerParser p = new AssemblerParser(tokens);
                BytecodeGenerator gen = new BytecodeGenerator(Defaults.SystemMethods.Values);
                
                p.SetGenerator(gen);
                p.TraceDestination = _traceDestination;
                p.program();

                if (p.NumberOfSyntaxErrors > 0 && _listener != null)
                {
                    _listener.Error(Convert.ToString(p.NumberOfSyntaxErrors) + " syntax error(s)");
                    return;
                }

                _result = gen.Result;
            }
            catch (GenerationException ex)
            {
                _listener.Error(ex.Message);
            }
        }
开发者ID:emperorstarfinder,项目名称:phlox,代码行数:26,代码来源:ByteCompilerFrontend.cs


示例4: NCalcLexer

	public NCalcLexer(ICharStream input, RecognizerSharedState state)
		: base(input, state)
	{


		OnCreated();
	}
开发者ID:sklose,项目名称:NCalc2,代码行数:7,代码来源:NCalcLexer.cs


示例5: Compile

        public static MAst Compile(AstHelper runtime, ICharStream stream)
        {
            var lexer = new TigerLexer(stream);
            var tokens = new CommonTokenStream(lexer);
            var parser = new TigerParser(tokens);
            ProgramExpression programExpression = parser.parse();

            if (parser.NumberOfSyntaxErrors > 0)
            {
                IEnumerable<string> errors = from e in parser.Errors
                                             select e.ToString();

                throw new SyntaxException(errors);
            }

            AstHelper helper = runtime.CreateChild(function: true, variables: true, types: true);
            programExpression.CheckSemantics(helper);

            if (helper.Errors.HasErrors)
            {
                throw new SemanticException(helper.Errors);
            }

            return programExpression.Transform();
        }
开发者ID:dayanruben,项目名称:TigerConverters,代码行数:25,代码来源:ProgramExpression.cs


示例6: csLexerWithPreProcessor

		public csLexerWithPreProcessor(ICharStream stream, IEnumerable<string> defines) : base(stream) {
			// By default we are preprocessing input
			Processing.Push(true);

			// Grab what's defined from the command line
			MacroDefines.UnionWith(defines);
		}
开发者ID:RainsSoft,项目名称:Code2Xml,代码行数:7,代码来源:csLexerWithPreProcessor.cs


示例7: AlloyColorizerLexer

        public AlloyColorizerLexer(ICharStream input, AlloyClassifierLexer lexer)
            : this(input)
        {
            Contract.Requires<ArgumentNullException>(lexer != null, "lexer");

            _lexer = lexer;
        }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:7,代码来源:AlloyColorizerLexer.g3.cs


示例8: MessageContractsLexer

	public MessageContractsLexer(ICharStream input, RecognizerSharedState state)
		: base(input, state)
	{


		OnCreated();
	}
开发者ID:Bolisov,项目名称:lokad-codedsl,代码行数:7,代码来源:MessageContractsLexer.cs


示例9: UniAspectLexer

	public UniAspectLexer(ICharStream input, RecognizerSharedState state)
		: base(input, state)
	{


		OnCreated();
	}
开发者ID:UnicoenProject,项目名称:UniAspect,代码行数:7,代码来源:UniAspectLexer.cs


示例10: ChapelCodeClassifierLexer

        public ChapelCodeClassifierLexer(ICharStream input, ChapelClassifierLexer lexer)
            : this(input)
        {
            Contract.Requires<ArgumentNullException>(lexer != null, "lexer");

            _lexer = lexer;
        }
开发者ID:sebandraos,项目名称:LangSvcV2,代码行数:7,代码来源:ChapelCodeClassifierLexer.g3.cs


示例11: CommonToken

 public CommonToken(ICharStream input, int type, int channel, int start, int stop) {
     this.input = input;
     this.type = type;
     this.channel = channel;
     this.start = start;
     this.stop = stop;
 }
开发者ID:jjchaverra,项目名称:antlr3,代码行数:7,代码来源:CommonToken.cs


示例12: AssemblerLexer

	public AssemblerLexer(ICharStream input, RecognizerSharedState state)
		: base(input, state)
	{


		OnCreated();
	}
开发者ID:emperorstarfinder,项目名称:phlox,代码行数:7,代码来源:AssemblerLexer.cs


示例13: compilacion

        private void compilacion(ICharStream input, string pathSalida)
        {
            compilacionOK = false;

            //Plantillas
            //TextReader groupFileR = new StreamReader("C:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FkvmIL.stg");
            TextReader groupFileR = new StreamReader(
                System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("FKVM.src.antlr.FkvmIL.stg"));
            StringTemplateGroup templates = new StringTemplateGroup(groupFileR);
            groupFileR.Close();

            //Análisis Léxico-Sintáctico
            Console.WriteLine("Análisis léxico-sintáctico...");
            //ANTLRFileStream input = new ANTLRFileStream(pathEntrada);
            FKVMLexer lexer = new FKVMLexer(input);

            CommonTokenStream tokens = new CommonTokenStream(lexer);
            FKVMParser parser = new FKVMParser(tokens);
            parser.TreeAdaptor = adaptor;
            parser.reportarError = re;
            FKVMParser.programa_return result = parser.programa();

            //Si no hay errores léxicos ni sintácticos ==> Análisis Semántico
            if (lexer.numErrors + parser.numErrors == 0)
            {
                //Analisis Semántico
                Console.WriteLine("Análisis semántico...");
                CommonTree t = ((CommonTree)result.Tree);
                //Console.WriteLine(t.ToStringTree() + "\n\n"); //
                CommonTreeNodeStream nodes2 = new CommonTreeNodeStream(t);
                nodes2.TokenStream = tokens;
                FKVMSem walker2 = new FKVMSem(nodes2);
                walker2.reportarError = re;
                walker2.programa(parser.symtable);

                //Si no hay errores en el análisis semántico ==> Generación de código
                if (walker2.numErrors == 0)
                {
                    //Generación de Código
                    Console.WriteLine("Generación de código...");
                    CommonTreeNodeStream nodes = new CommonTreeNodeStream(t);
                    nodes.TokenStream = tokens;
                    FKVMGen walker = new FKVMGen(nodes);
                    walker.TemplateLib = templates;
                    FKVMGen.programa_return r2 = walker.programa(parser.numVars);

                    //Presentación de resultados
                    StringTemplate output = (StringTemplate)r2.Template;
                    //Console.WriteLine(output.ToString());

                    StreamWriter pw = new StreamWriter(pathSalida);
                    pw.WriteLine(output.ToString());
                    pw.Flush();
                    pw.Close();

                    compilacionOK = true;
                }
            }
        }
开发者ID:sgolivernet,项目名称:fkscript,代码行数:59,代码来源:FKVMCompiler.cs


示例14: ZealCpuDriver

 private ZealCpuDriver(ICharStream antlrInputStream)
 {
     _lexer = new ZealCpuLexer(antlrInputStream);
     _tokenStream = new CommonTokenStream(_lexer);
     _parser = new ZealCpuParser(_tokenStream);
     _parser.RemoveErrorListeners();
     _parser.AddErrorListener(new CpuErrorListener(this));
 }
开发者ID:zealsnes,项目名称:compiler,代码行数:8,代码来源:ZealCpuDriver.cs


示例15: AntlrGrammarClassifierLexer

        internal AntlrGrammarClassifierLexer(ICharStream input, AntlrClassifierLexer lexer)
            : this(input)
        {
            Contract.Requires<ArgumentNullException>(input != null, "input");
            Contract.Requires<ArgumentNullException>(lexer != null, "lexer");

            _lexer = lexer;
        }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:8,代码来源:AntlrGrammarClassifierLexer.g3.cs


示例16: JavaUnicodeInputStream

        public JavaUnicodeInputStream([NotNull] ICharStream source)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            this._source = source;
            this._la1 = source.La(1);
        }
开发者ID:EvgeniyKo,项目名称:antlr4cs,代码行数:8,代码来源:JavaUnicodeInputStream.cs


示例17: RecognitionException

 public RecognitionException(Lexer lexer, ICharStream input)
 {
     // TODO: make a dummy recognizer for the interpreter to use?
     // Next two (ctx,input) should be what is in recognizer, but
     // won't work when interpreting
     this.recognizer = lexer;
     this.input = input;
 }
开发者ID:pabloescribano,项目名称:antlr4cs,代码行数:8,代码来源:RecognitionException.cs


示例18: Compile

        public InWorldz.Phlox.Glue.CompilerFrontend Compile(ICharStream input)
        {
            InWorldz.Phlox.Glue.CompilerFrontend frontEnd = new InWorldz.Phlox.Glue.CompilerFrontend(_listener, "..\\..\\..\\..\\grammar", true);
            frontEnd.OutputASTGraph = true;

            frontEnd.Compile(input);

            return frontEnd;
        }
开发者ID:emperorstarfinder,项目名称:phlox,代码行数:9,代码来源:CompilerFrontend.cs


示例19: ParseImports

 /*
  * There's one fairly important difference between mod resolution in rustc and what we do.
  * Given following code:
  * mod bar { mod a; } mod bar { mod b; }
  * We will merget this to mod bar { mod a; mod b; }, but rustc will error out.
  */
 public static ModuleImport ParseImports(ICharStream stream)
 {
     var lexer = new ModuleLexer(stream);
     var tokens = new CommonTokenStream(lexer);
     var parser = new ModuleParser(tokens);
     BodyContext root = parser.body();
     var imports = new ModuleImport();
     TraverseForImports(root, imports);
     return imports;
 }
开发者ID:whuthj,项目名称:VisualRust,代码行数:16,代码来源:ModuleParser.g4.cs


示例20: CreateTree

        protected virtual IParseTree CreateTree(ICharStream input, IEnumerable<IAntlrErrorListener<int>> lexerErrorListeners,
            IEnumerable<IAntlrErrorListener<IToken>> errorListeners)
        {
            if (input == null) 
                throw new ArgumentNullException("input");

            var builder = _treeBuilder;
            var tree = builder.CreateTree(input, lexerErrorListeners, errorListeners);

            return tree;
        }
开发者ID:j0rdm4n,项目名称:ANTLR4.ParserHelpers,代码行数:11,代码来源:TreeWorker.cs



注:本文中的ICharStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICharTermAttribute类代码示例发布时间:2022-05-24
下一篇:
C# ICharSequence类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap