本文整理汇总了C#中ICharStream类的典型用法代码示例。如果您正苦于以下问题:C# ICharStream类的具体用法?C# ICharStream怎么用?C# ICharStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICharStream类属于命名空间,在下文中一共展示了ICharStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MatlabLexer
public MatlabLexer(ICharStream input, Configuration configuration)
: this(input)
{
Checker.CheckNotNull(configuration);
this.Configuration = configuration;
}
示例2: FuncProtoToShimLexer
public FuncProtoToShimLexer(ICharStream input, RecognizerSharedState state)
: base(input, state)
{
OnCreated();
}
示例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);
}
}
示例4: NCalcLexer
public NCalcLexer(ICharStream input, RecognizerSharedState state)
: base(input, state)
{
OnCreated();
}
示例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();
}
示例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);
}
示例7: AlloyColorizerLexer
public AlloyColorizerLexer(ICharStream input, AlloyClassifierLexer lexer)
: this(input)
{
Contract.Requires<ArgumentNullException>(lexer != null, "lexer");
_lexer = lexer;
}
示例8: MessageContractsLexer
public MessageContractsLexer(ICharStream input, RecognizerSharedState state)
: base(input, state)
{
OnCreated();
}
示例9: UniAspectLexer
public UniAspectLexer(ICharStream input, RecognizerSharedState state)
: base(input, state)
{
OnCreated();
}
示例10: ChapelCodeClassifierLexer
public ChapelCodeClassifierLexer(ICharStream input, ChapelClassifierLexer lexer)
: this(input)
{
Contract.Requires<ArgumentNullException>(lexer != null, "lexer");
_lexer = lexer;
}
示例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;
}
示例12: AssemblerLexer
public AssemblerLexer(ICharStream input, RecognizerSharedState state)
: base(input, state)
{
OnCreated();
}
示例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;
}
}
}
示例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));
}
示例15: AntlrGrammarClassifierLexer
internal AntlrGrammarClassifierLexer(ICharStream input, AntlrClassifierLexer lexer)
: this(input)
{
Contract.Requires<ArgumentNullException>(input != null, "input");
Contract.Requires<ArgumentNullException>(lexer != null, "lexer");
_lexer = lexer;
}