本文整理汇总了C#中ILexer.Tokenize方法的典型用法代码示例。如果您正苦于以下问题:C# ILexer.Tokenize方法的具体用法?C# ILexer.Tokenize怎么用?C# ILexer.Tokenize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILexer
的用法示例。
在下文中一共展示了ILexer.Tokenize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FollowChain
//.........这里部分代码省略.........
else if (wb.Names.ContainsKey(adrName))
{
name = wb.Names[t.Value];
if (string.IsNullOrEmpty(adrWs))
{
f.ws = name.Worksheet;
}
}
else
{
name = null;
}
if (name != null)
{
if (string.IsNullOrEmpty(name.NameFormula))
{
if (name.NameValue == null)
{
f.iterator = new CellsStoreEnumerator<object>(f.ws._formulas, name.Start.Row,
name.Start.Column, name.End.Row, name.End.Column);
goto iterateCells;
}
}
else
{
var id = ExcelAddressBase.GetCellID(name.LocalSheetId, name.Index, 0);
if (!depChain.index.ContainsKey(id))
{
var rf = new FormulaCell() { SheetID = name.LocalSheetId, Row = name.Index, Column = 0 };
rf.Formula = name.NameFormula;
rf.Tokens = name.LocalSheetId == -1 ? lexer.Tokenize(rf.Formula).ToList() : lexer.Tokenize(rf.Formula, wb.Worksheets.GetBySheetID(name.LocalSheetId).Name).ToList();
depChain.Add(rf);
stack.Push(f);
f = rf;
goto iterateToken;
}
else
{
if (stack.Count > 0)
{
//Check for circular references
foreach (var par in stack)
{
if (ExcelAddressBase.GetCellID(par.SheetID, par.Row, par.Column) == id)
{
throw (new CircularReferenceException(string.Format("Circular Reference in name {0}", name.Name)));
}
}
}
}
}
}
}
f.tokenIx++;
}
depChain.CalcOrder.Add(f.Index);
if (stack.Count > 0)
{
f = stack.Pop();
goto iterateCells;
}
return;
示例2: GetChain
private static void GetChain(DependencyChain depChain, ILexer lexer, ExcelRangeBase Range, ExcelCalculationOption options)
{
var ws = Range.Worksheet;
var fs = new CellsStoreEnumerator<object>(ws._formulas, Range.Start.Row, Range.Start.Column, Range.End.Row, Range.End.Column);
while (fs.Next())
{
if (fs.Value == null || fs.Value.ToString().Trim() == "") continue;
var id = ExcelCellBase.GetCellID(ws.SheetID, fs.Row, fs.Column);
if (!depChain.index.ContainsKey(id))
{
var f = new FormulaCell() { SheetID = ws.SheetID, Row = fs.Row, Column = fs.Column };
if (fs.Value is int)
{
f.Formula = ws._sharedFormulas[(int)fs.Value].GetFormula(fs.Row, fs.Column, ws.Name);
}
else
{
f.Formula = fs.Value.ToString();
}
if (!string.IsNullOrEmpty(f.Formula))
{
f.Tokens = lexer.Tokenize(f.Formula, Range.Worksheet.Name).ToList();
ws._formulaTokens.SetValue(fs.Row, fs.Column, f.Tokens);
depChain.Add(f);
FollowChain(depChain, lexer, ws.Workbook, ws, f, options);
}
}
}
}
示例3: RunQuery
static void RunQuery(string query, ILexer lexer)
{
Console.WriteLine(query);
foreach (var token in lexer.Tokenize(query))
{
Console.WriteLine(token);
}
}