Skip to content

Simple File Processing

Marcus edited this page Oct 14, 2015 · 1 revision

The Jefferson.FileProcessing project provides support for processing files. It provides various implementations to support processing files out of the box.

Note: This API requires more testing.

FileScopeContext<TSelf, TProcessor> provides an implementation of a context class. The idea is you inherit from this and add any properties, fields or methods you want to expose to Jefferson, e.g.

public class MyContext: FileScopeContext<MyContext, SimpleFileProcessor<MyContext>>
{
   public String Foobar = "foobar"; // $$ Foobar $$ can be used now
}

This context also implements a key-value store that supports file level scoping. First off this means

$$#define foo = 'bar' /$$

works because the key "foo" was set to value "bar". The context implements an IVariableBinder to make this work.

Secondly, this means that e.g. the following works

file A ($$#define foo = 'bar' /$$)
|   \
|    \... file B ($$#define foo = 'qux' /$$)
|    |... file C $$ foo $$
|
file D $$ foo $$

Files at the top-level are processed within their own scope. This means in e.g. file D foo has value "bar". File B redefines foo and it's visible as "qux" in file C but this #define does not affect the value of foo in the parent scope (so in file D it's still "bar").

Clone this wiki locally