Ast.SyntaxNode _GetExpression(FtlParserStream ps) { ps.SkipInlineWs(); var selector = GetSelectorExpression(ps); ps.SkipInlineWs(); if (ps.CurrentIs('-')) { ps.Peek(); if (!ps.CurrentPeekIs('>')) { ps.ResetPeek(); return(selector); } if (selector is Ast.MessageReference) { throw new ParseException("E0016"); } if (selector is Ast.AttributeExpression ae && ae.Ref is Ast.MessageReference) { throw new ParseException("E0018"); } if (selector is Ast.VariantExpression) { throw new ParseException("E0017"); } ps.Next(); ps.Next(); ps.SkipInlineWs(); var variants = GetVariants(ps); if (variants.Count == 0) { throw new ParseException("E0011"); } // VariantLists are only allowed in other VariantLists. if (variants.Any(v => v.Value is Ast.VariantList)) { throw new ParseException("E0023"); } ps.ExpectIndent(); return(new Ast.SelectExpression(selector, variants)); } else if (selector is Ast.AttributeExpression ae && ae.Ref is Ast.TermReference) { throw new ParseException("E0019"); } return(selector); }