public InvokeParser(ExpressionBuilder builder) : base(builder) { }
public RefParser(ExpressionBuilder builder) : base(builder) { }
public IfAsAndParser(ExpressionBuilder builder) : base(builder, ExpressionFlags.OmitSendMessageAssign) { }
public KeywordValueParser(ExpressionBuilder builder) : base(builder) { }
public StringParser(ExpressionBuilder builder) : base(builder) { }
public DictionaryParser(ExpressionBuilder builder) : base(builder) { }
public PostfixOperatorsParser(ExpressionBuilder builder) : base(builder) { }
public ClassReferenceParser(ExpressionBuilder builder) : base(builder) { }
public ComparisandParser(ExpressionBuilder builder) : base(builder) { }
public BindingParser(ExpressionBuilder builder) : base(builder) { }
public RangeOperatorParser(ExpressionBuilder builder) : base(builder) { }
public TryBlockParser(ExpressionBuilder builder) : base(builder) { }
public SymbolObjectParser(ExpressionBuilder builder) : base(builder) { }
public override IMatched <Unit> Parse(ParseState state, Token[] tokens, ExpressionBuilder builder) { var functionName = tokens[2].Text; if (functionName == @"\/") { return(notMatched <Unit>()); } else { state.Colorize(tokens, Color.Whitespace, Color.Invokable, Color.OpenParenthesis); if (getArgumentsPlusLambda(state, builder.Flags).ValueOrCast <Unit>(out var tuple, out var asUnit)) { var(arguments, possibleLambda) = tuple; if (state.BlockFollows()) { state.Scan("^ /':'", Color.Structure); if (state.Advance().ValueOrOriginal(out _, out var unitMatched)) { var tempObjectField = newLabel("object"); var outerBuilder = new ExpressionBuilder(ExpressionFlags.Standard); var setPropertyParser = new SetPropertyParser(builder, tempObjectField, outerBuilder); while (state.More) { if (setPropertyParser.Scan(state).If(out _, out var anyException)) { } else if (anyException.If(out var exception)) { return(failedMatch <Unit>(exception)); } else { break; } } state.Regress(); if (outerBuilder.ToExpression().If(out var outerExpression, out var outerException)) { builder.Add(new NewObjectSymbol(tempObjectField, functionName, outerExpression)); } else { return(failedMatch <Unit>(outerException)); } } else { return(unitMatched); } } else if (state.Macro(functionName).If(out var function)) { builder.Add(new MacroInvokeSymbol(function, arguments)); } else { builder.Add(new InvokeSymbol(functionName, arguments, possibleLambda, builder.Flags[ExpressionFlags.Comparisand])); } return(Unit.Matched()); }
public ThrowParser(ExpressionBuilder builder, ExpressionFlags flags = ExpressionFlags.Standard) : base(builder, flags) { }
public WhateverParser(ExpressionBuilder builder) : base(builder) { }
public CharParser(ExpressionBuilder builder) : base(builder) { }
public ArrayParser(ExpressionBuilder builder) : base(builder) { }
public BooleanParser(ExpressionBuilder builder) : base(builder) { }
public WhereParser(ExpressionBuilder builder) : base(builder) { }
public LazyParser(ExpressionBuilder builder) : base(builder) { }
public FloatParser(ExpressionBuilder builder) : base(builder) { }
public ReductionParser(ExpressionBuilder builder) : base(builder) { }
public OctalParser(ExpressionBuilder builder) : base(builder) { }
public override IMatched <Unit> Parse(ParseState state, Token[] tokens, ExpressionBuilder builder) { var prefix = tokens[2].Text; var mutable = prefix == "m"; var binary = prefix == "b"; var symbol = prefix == "`"; state.Colorize(tokens, Color.Whitespace, Color.StringPart, Color.String); var text = new StringBuilder(); var escaped = false; var index = state.Index; var length = 0; var hex = false; var hexText = new StringBuilder(); while (state.More) { var ch = state.CurrentSource[0]; switch (ch) { case '"': if (escaped) { text.Append('"'); escaped = false; break; } if (hex) { if (fromHex(hexText.ToString()).If(out var matchedChar, out var anyException)) { text.Append(matchedChar); } else if (anyException.If(out var exception)) { return(failedMatch <Unit>(exception)); } else { return(failedMatch <Unit>(badHex(hexText.ToString()))); } } state.Move(1); state.AddToken(index, length + 1, Color.String); if (mutable) { builder.Add(new MutStringSymbol(text.ToString())); return(Unit.Matched()); } else if (binary) { builder.Add(new ByteArraySymbol(text.ToString())); return(Unit.Matched()); } else if (symbol) { builder.Add(new SymbolSymbol(text.ToString())); return(Unit.Matched()); } else { builder.Add(new StringSymbol(text.ToString())); return(Unit.Matched()); } case '\\': if (escaped) { text.Append('\\'); escaped = false; break; } escaped = true; break; case 'n': if (escaped) { text.Append('\n'); escaped = false; break; } text.Append('n'); break; case 'r': if (escaped) { text.Append('\r'); escaped = false; break; } text.Append('r'); break; case 't': if (escaped) { text.Append('\t'); escaped = false; break; } text.Append('t'); break; case 'u': if (escaped) { hex = true; hexText.Clear(); escaped = false; break; } text.Append('u'); break; case '{': if (escaped) { hex = true; hexText.Clear(); escaped = false; break; } text.Append('{'); break; default: if (hex) { if (ch.Between('0').And('9') || ch.Between('a').And('f') && hexText.Length < 6) { hexText.Append(ch); } else { hex = false; if (fromHex(hexText.ToString()).ValueOrCast <Unit>(out var matchedChar, out var asUnit)) { text.Append(matchedChar); } else if (asUnit.IsFailedMatch) { return(asUnit); } if (ch == 96) { text.Append(ch); } } } else { text.Append(ch); } escaped = false; break; } length++; state.Move(1); } return(failedMatch <Unit>(openString())); }
public ByteParser(ExpressionBuilder builder) : base(builder) { }
public ConversionParser(ExpressionBuilder builder) : base(builder) { }
public ImplicitSymbolParser(ExpressionBuilder builder) : base(builder) { }
public OneParameterLambdaParser(ExpressionBuilder builder) : base(builder) { }
public WhereItemParser(ExpressionBuilder builder) : base(builder, ExpressionFlags.OmitColon | ExpressionFlags.OmitComma | ExpressionFlags.Comparisand) { }