本文整理汇总了C#中ILexer类的典型用法代码示例。如果您正苦于以下问题:C# ILexer类的具体用法?C# ILexer怎么用?C# ILexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILexer类属于命名空间,在下文中一共展示了ILexer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PrepareLexer
protected override ILexer<Token> PrepareLexer(ILexer<Token> lexer, ICharSource file, int position)
{
if (lexer == null)
return new EcsLexer(file, "?", MessageSink.Trace, position);
((EcsLexer)lexer).Reset(file, "?", position);
return lexer;
}
开发者ID:jonathanvdc,项目名称:Loyc,代码行数:7,代码来源:EcsSyntaxForVS.cs
示例2: MoshParser
public MoshParser(ILexer lexer)
{
m_startRuleToken = new Token { TokenType = TokenType.NEW_RULE };
m_tree = new Node<string>();
m_lexer = lexer;
m_consumed = new Stack<Token>();
m_err = new Queue<Error>();
// Setup rule pre-calling conditions
m_rulePreHook = name =>
{
if (m_tree.Value == null)
{
m_tree.Value = name;
return m_tree;
}
var tempNode = m_tree;
var newTopNode = m_tree.AddChild(name);
m_tree = newTopNode;
return tempNode;
};
// Setup rule post-calling conditions
m_rulePostHook = node => m_tree = node;
}
开发者ID:predator5047,项目名称:recursive-descent,代码行数:26,代码来源:MoshParser.cs
示例3: GetMatches
public IEnumerable<ILexer> GetMatches(ILexer lexer, string ruleName)
{
var wrapRules = new List<GrammarRule>();
var results = new List<ILexer>();
foreach (var rule in _table.Get(ruleName))
{
if (rule.Elements[0] is GrammarRuleElementEmbed && ((GrammarRuleElementEmbed) rule.Elements[0]).RuleName == ruleName)
{
if (rule.Elements.Length > 1)
wrapRules.Add(rule);
}
else
{
foreach (var match in GetMatches(lexer, rule))
{
yield return match;
results.Add(match);
}
}
}
foreach (var start in results)
foreach (var match in MatchesRecursive(start, wrapRules))
yield return match;
}
开发者ID:ikkentim,项目名称:earlescript,代码行数:26,代码来源:GrammarProcessor.cs
示例4: MainLoop
private static void MainLoop(ILexer lexer, IParser parser)
{
// top ::= definition | external | expression | ';'
while (true)
{
Console.Write("ready> ");
switch (lexer.CurrentToken)
{
case (int)Token.EOF:
return;
case ';':
lexer.GetNextToken();
break;
case (int)Token.DEF:
parser.HandleDefinition();
break;
case (int)Token.EXTERN:
parser.HandleExtern();
break;
default:
parser.HandleTopLevelExpression();
break;
}
}
}
开发者ID:rflechner,项目名称:LLVMSharp,代码行数:25,代码来源:Program.cs
示例5: SpimiIndexer
public SpimiIndexer(ILexer lexer)
{
this.lexer = lexer;
this.blockReader = new SpimiBlockReader();
this.blockWriter = new SpimiBlockWriter();
this.fileIndexWriter = new FileIndexWriter();
}
开发者ID:taoneill,项目名称:SPIMI,代码行数:7,代码来源:SpimiIndexer.cs
示例6: T4Parser
internal T4Parser([NotNull] T4Environment t4Environment, [NotNull] DirectiveInfoManager directiveInfoManager, [NotNull] ILexer lexer,
[CanBeNull] IPsiSourceFile sourceFile) {
_t4Environment = t4Environment;
_directiveInfoManager = directiveInfoManager;
_lexer = lexer;
_sourceFile = sourceFile;
}
开发者ID:mnaoumov,项目名称:ForTea,代码行数:7,代码来源:T4Parser.cs
示例7: Run
public static void Run(TreeElement node, ILexer lexer, ITokenOffsetProvider offsetProvider, bool trimTokens, SeldomInterruptChecker interruptChecker)
{
Assertion.Assert(node.parent == null, "node.parent == null");
var root = node as CompositeElement;
if (root == null)
{
return;
}
var inserter = new PsiMissingTokensInserter(lexer, offsetProvider, interruptChecker);
lexer.Start();
if (trimTokens)
{
using (var container = new DummyContainer(root))
{
inserter.Run(container);
}
}
else
{
var terminator = new EofToken(lexer.Buffer);
root.AppendNewChild(terminator);
inserter.Run(root);
root.DeleteChildRange(terminator, terminator);
}
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:28,代码来源:PsiMissingsTokenInserter.cs
示例8: PsiParser
public PsiParser(ILexer lexer)
{
myCheckForInterrupt = new SeldomInterruptChecker();
myOriginalLexer = lexer;
myLexer = new FilteringPsiLexer(lexer);
myLexer.Start();
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:PsiParser.cs
示例9: NTriplesParser
public NTriplesParser(ILexer lexer, CommonIdentifierIntern commonIdentifierIntern)
{
this.commonIdentifierIntern = commonIdentifierIntern;
this.originalLexer = lexer;
this.myCheckForInterrupt = new SeldomInterruptChecker();
this.setLexer(new NTriplesFilteringLexer(lexer));
}
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:7,代码来源:NTriplesParser.cs
示例10: Create
/// <inheritdoc />
public ILexer<Repetition> Create(ILexer lexer)
{
if (lexer == null)
{
throw new ArgumentNullException(nameof(lexer));
}
return new OptionLexer(lexer);
}
开发者ID:kusl,项目名称:TextFx,代码行数:9,代码来源:OptionLexerFactory.cs
示例11: Parser
public Parser(ILexer lexer)
{
this.lexer = lexer;
// prime the lookahead
this.currentToken = lexer.GetToken ();
this.nextToken = lexer.GetToken ();
}
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:8,代码来源:Parser.cs
示例12: SpimiIndexer
public SpimiIndexer(ILexer lexer, IParser parser, Stream indexStream, Stream metadata)
{
this.lexer = lexer;
this.parser = parser;
this.termIndexBlockWriter = new SpimiBlockWriter();
this.indexStream = indexStream;
this.metadataWriter = new CollectionMetadataWriter(metadata);
}
开发者ID:tristanstcyr,项目名称:SPIMI,代码行数:8,代码来源:SpimiIndexer.cs
示例13: EdgeParser
public EdgeParser(ILexer lexer)
{
this.lexer = lexer;
assemblies = new HashSet<string>();
namespaces = new HashSet<string>();
objects = new Dictionary<string, ObjectNode>();
}
开发者ID:sys27,项目名称:Edge,代码行数:8,代码来源:EdgeParser.cs
示例14: RunQuery
static void RunQuery(string query, ILexer lexer)
{
Console.WriteLine(query);
foreach (var token in lexer.Tokenize(query))
{
Console.WriteLine(token);
}
}
开发者ID:synhershko,项目名称:OTAutocompleteDSL,代码行数:8,代码来源:Program.cs
示例15: SetupLexer
public void SetupLexer(ILexer lexer)
{
if (lexer == null)
throw new ArgumentNullException("lexer");
lexer.IgnoreWhitespace = true;
lexer.TokenDefinitions = _tokenDefinitions;
}
开发者ID:KallDrexx,项目名称:cs262,代码行数:8,代码来源:HtmlTokenDefinitions.cs
示例16: Parser
public Parser(ILexer lexer, IOperandFactory directOperandFactory, IOperandFactory indirectOperandFactory)
{
this.lexer = lexer;
this.indirectOperandFactory = indirectOperandFactory;
this.directOperandFactory = directOperandFactory;
lexer.ConsumeTokenStrategy = new PeekTokenStrategy(new IgnoreWhiteSpaceTokenStrategy());
this.statments = new List<Statment>();
}
开发者ID:pedromsantos,项目名称:DCPU16.Net,代码行数:10,代码来源:Parser.cs
示例17: Parser
protected Parser(ILexer lexer)
{
if (lexer == null)
throw new ArgumentNullException("lexer");
_lexer = lexer;
_tokenQueue = new List<Token>();
_prefixParselets = new Dictionary<string, IPrefixParselet>();
_infixParselets = new Dictionary<string, IInfixParselet>();
_statementParselets = new Dictionary<string, StatementParselet>();
}
开发者ID:PeterBassett,项目名称:Parser,代码行数:11,代码来源:Parser.cs
示例18: Parse
public IListSource<LNode> Parse(ILexer<Token> input, IMessageSink msgs, ParsingMode inputType = null, bool preserveComments = true)
{
var preprocessed = new EcsPreprocessor(input, preserveComments);
var treeified = new TokensToTree(preprocessed, false);
var results = Parse(treeified.Buffered(), input.SourceFile, msgs, inputType);
if (preserveComments) {
var injector = new EcsTriviaInjector(preprocessed.TriviaList, input.SourceFile,
(int)TokenType.Newline, "/*", "*/", "//");
return injector.Run(results.GetEnumerator()).Buffered();
} else
return results;
}
开发者ID:qwertie,项目名称:ecsharp,代码行数:12,代码来源:EcsLanguageService.cs
示例19: GetMatch
public string GetMatch(ILexer lexer, bool onlyStatements = false)
{
foreach (var ruleName in _table.Where(rule => !onlyStatements || rule.IsStatement).Select(r => r.Name).Distinct())
{
if (IsMatch(lexer, ruleName))
{
return ruleName;
}
}
return null;
}
开发者ID:ikkentim,项目名称:earlescript,代码行数:12,代码来源:GrammarProcessor.cs
示例20: Match
public IEnumerable<ILexer> Match(GrammarProcessor grammar, ILexer lexer)
{
foreach (var tokenType in TokenTypes)
{
if (TokenValue == null ? lexer.Current.Is(tokenType) : lexer.Current.Is(tokenType, TokenValue))
{
var newLexer = (ILexer) lexer.Clone();
newLexer.MoveNext();
yield return newLexer;
}
}
}
开发者ID:ikkentim,项目名称:earlescript,代码行数:12,代码来源:GrammarRuleElementLiteral.cs
注:本文中的ILexer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论