コード例 #1
0
 /// <summary>
 ///     Resolves a script block
 /// </summary>
 /// s
 public ScriptBlockResolver(BlockStyles style)
 {
     _style     = style;
     _resolvers = new ITokenResolver[]
     {
         new KeywordResolver("true", TokenTypes.True),
         new KeywordResolver("false", TokenTypes.False),
         new KeywordResolver("null", TokenTypes.Null),
         new KeywordResolver("???", TokenTypes.DefaultUndefinedOrNullValue),
         new KeywordResolver("??", TokenTypes.DefaultNullValue),
         new KeywordResolver(">", TokenTypes.GreaterThan),
         new KeywordResolver("<", TokenTypes.LessThan),
         new KeywordResolver("!=", TokenTypes.NotEqual),
         new KeywordResolver("==", TokenTypes.Equal),
         new KeywordResolver("+", TokenTypes.Plus),
         new KeywordResolver("-", TokenTypes.Minus),
         new KeywordResolver("*", TokenTypes.Times),
         new KeywordResolver("/", TokenTypes.Divide),
         new KeywordResolver(":", TokenTypes.Colon),
         new KeywordResolver("?", TokenTypes.QuestionMark),
         new KeywordResolver("(", TokenTypes.LeftParentheses),
         new KeywordResolver(")", TokenTypes.RightParentheses),
         new KeywordResolver(",", TokenTypes.Comma),
         new NumberResolver(_terminatorChars),
         new IdentityResolver(),
         new StringResolver(),
         new CharResolver(),
         new IgnoreCharResolver(' ', '\n', '\t')
     };
 }
コード例 #2
0
 public BindingLexer(BlockStyles style = BlockStyles.CSharp)
 {
     _resolvers = new ITokenResolver[]
     {
         new ScriptBlockResolver(style),
         new TextBlockResolver(style)
     };
 }
コード例 #3
0
        public BindingResolver(BlockStyles blockStyle = BlockStyles.CSharp, IFunctionRunner runner = null, BindingLexer lexer = null, BindingParser parser = null,
                               IAstCache cache        = null)
        {
            _lexer     = lexer ?? new BindingLexer(blockStyle);
            _parser    = parser ?? new BindingParser();
            BlockStyle = blockStyle;
            Cache      = cache;

            // Always setup standard functions
            UseRunner(new ObjectMethodRunner(new ScriptFunctions()));

            // Add custom functions
            if (runner != null)
            {
                UseRunner(runner);
            }
        }
コード例 #4
0
 public TextBlockResolver(BlockStyles style)
 {
     _style = style;
 }