public virtual Tokenizer CreateTokenizer(Action<Token> tokenConsumer,
		                                         Action tokenReady,
		                                         Action lineReady,
		                                         CompilationContext compilationContext)
        {
            return new RootTokenizer(tokenConsumer, tokenReady, lineReady, compilationContext);
        }
Exemple #2
0
 public static void Main(string[] args)
 {
     var context = new CompilationContext();
     var driver = new Driver((s, i) => { }, context);
     var column = 0;
     foreach(var c in @"""{foo}""") {
         driver.Tokenize(new Character(c, new Location(null, 0, column)));
         column++;
     }
     driver.OnDone();
 }
Exemple #3
0
        public Driver(Consumer consumer, CompilationContext compilationContext)
        {
            if(consumer == null) {
                throw new ArgumentNullException("consumer");
            } else if(compilationContext == null) {
                throw new ArgumentNullException("compilationContext");
            }

            this.compilationContext = compilationContext;
            this.syntaxifier = new Syntaxifier(
                syntax => consumer(indentation, syntax),
                e => compilationContext.HandleSyntaxError(e));
        }