Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CustomScanner.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using Irony.Parsing;
4 
5 namespace SiliconStudio.Shaders.Grammar
6 {
7  /// <summary>
8  /// A Custom Scanner used for Irony
9  /// </summary>
10  internal class CustomScanner : Scanner
11  {
12  private Tokenizer tokenizer;
13 
14  /// <summary>
15  /// Initializes a new instance of the <see cref="CustomScanner"/> class.
16  /// </summary>
17  /// <param name="tokenizer">The tokenizer.</param>
18  public CustomScanner(Tokenizer tokenizer)
19  {
20  this.tokenizer = tokenizer;
21  }
22 
23  /// <inheritdoc/>
24  public override SourceLocation Location
25  {
26  get
27  {
28  return tokenizer.Location;
29  }
30 
31  set
32  {
33  tokenizer.Location = value;
34  }
35  }
36 
37  /// <inheritdoc/>
38  public override void SetSourceText(string sourceText, string sourceFileName)
39  {
40  tokenizer.SetSourceText(sourceText, sourceFileName);
41  }
42 
43  /// <inheritdoc/>
44  protected override void NextToken()
45  {
46  Context.CurrentToken = tokenizer.GetNextToken();
47  }
48 
49  /// <inheritdoc/>
50  protected override void PrepareInput()
51  {
52  }
53  }
54 }
Scanner base class. The Scanner's function is to transform a stream of characters into aggregates/wor...
Definition: Scanner.cs:22