static IExpression CreateFunctionInvocation( IList <IFunctionInstance> pool, TextFileRange range, INamedExpressionTuple leftArguments, INamedExpressionTuple rightArguments) { var filteredPool = FilterFunctionLeftArguments(pool, leftArguments); filteredPool = FilterFunctionRightArguments(filteredPool, rightArguments); return(filteredPool.Count != 1 ? null : CreateFunctionInvocation(filteredPool.First(), range, leftArguments, rightArguments)); // TODO: proper error handling }
static IExpression CreateFunctionInvocation( IFunctionInstance function, TextFileRange range, INamedExpressionTuple leftArguments, INamedExpressionTuple rightArguments) { var invocation = new FunctionInvocation { Function = function, Range = range, Left = AssignArguments(function.LeftArguments, leftArguments), Right = AssignArguments(function.RightArguments, rightArguments) }; return(invocation); }
private void _eatBlockComment() { var startLine = new TextFileRange(_textParser.CurrentLine, _textParser.CurrentIndex); // Handle nested /* nicely. var depth = 1; // Take the * of the /*. _textParser.Take(); while (!_textParser.IsEOF()) { if (_textParser.IsEOL()) { _textParser.NextLine(); continue; } var chr = _textParser.Take(); if (chr == '/' && _textParser.Peek() == '*') { _textParser.Take(); depth += 1; continue; } if (chr == '*' && _textParser.Peek() == '/') { _textParser.Take(); depth -= 1; if (depth <= 0) { return; } } } // Unterminated block comment! throw new ShaderParseException("Block comment does not end", startLine); }
public TokenSymbol(Symbols symbol, TextFileRange position) : base(position) { Symbol = symbol; }
public TokenNumber(string number, TextFileRange position) : base(position) { Number = number; }
public TokenWord(string word, TextFileRange position) : base(position) { Word = word; }
protected Token(TextFileRange position) { Position = position; }