pike.git/
src/
language.yacc
Branch:
Tag:
Non-build tags
All tags
No tags
2016-05-08
2016-05-08 18:54:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>
f99cddea0eb26403bc3a38fdffc619ed04f5bde8 (
97
lines) (+
51
/-
46
)
[
Show
|
Annotate
]
Branch:
8.1
Compiler: Broke out literal_expr from expr4.
This makes the grammar somewhat easier to read.
339:
%type <n> idents2 %type <n> labeled_statement %type <n> lambda
+
%type <n> literal_expr
%type <n> local_name_list %type <n> low_idents %type <n> safe_lvalue
3496:
} ;
-
expr4:
string
-
| TOK
_
NUMBER
-
| TOK_FLOAT { $$=mkfloatnode((FLOAT_TYPE)$1); }
+
expr4:
literal
_
expr
| catch | gauge | typeof
3615:
} free_node ($1); }
-
| open_paren_with_line_info '{' expr_list close_brace_or_missing ')'
-
{
-
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
-
$$=mkefuncallnode("aggregate",$3);
-
COPY_LINE_NUMBER_INFO($$, $1);
-
free_node ($1);
-
}
-
| open_paren_with_line_info
-
open_bracket_with_line_info /* Only to avoid shift/reduce conflicts. */
-
m_expr_list close_bracket_or_missing ')'
-
{
-
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
-
$$=mkefuncallnode("aggregate_mapping",$3);
-
COPY_LINE_NUMBER_INFO($$, $1);
-
free_node ($1);
-
free_node ($2);
-
}
-
| TOK_MULTISET_START line_number_info expr_list TOK_MULTISET_END
-
{
-
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
-
$$=mkefuncallnode("aggregate_multiset",$3);
-
COPY_LINE_NUMBER_INFO($$, $2);
-
free_node ($2);
-
}
-
| TOK_MULTISET_START line_number_info expr_list ')'
-
{
-
yyerror("Missing '>'.");
-
$$=mkefuncallnode("aggregate_multiset",$3);
-
COPY_LINE_NUMBER_INFO($$, $2);
-
free_node ($2);
-
}
+
| open_paren_with_line_info error ')' { $$=$1; yyerrok; } | open_paren_with_line_info error TOK_LEX_EOF {
3654:
} | open_paren_with_line_info error ';' { $$=$1; yyerror("Missing ')'."); } | open_paren_with_line_info error '}' { $$=$1; yyerror("Missing ')'."); }
-
| TOK_MULTISET_START line_number_info error TOK_MULTISET_END { $$=$2; yyerrok; }
-
| TOK_MULTISET_START line_number_info error ')' {
-
yyerror("Missing '>'.");
-
$$=$2; yyerrok;
-
}
-
| TOK_MULTISET_START line_number_info error TOK_LEX_EOF
-
{
-
$$=$2; yyerror("Missing '>)'.");
-
yyerror("Unexpected end of file.");
-
}
-
| TOK_MULTISET_START line_number_info error ';' { $$=$2; yyerror("Missing '>)'."); }
-
| TOK_MULTISET_START line_number_info error '}' { $$=$2; yyerror("Missing '>)'."); }
+
| expr4 TOK_ARROW line_number_info magic_identifier { $$=mknode(F_ARROW,$1,$4);
3787:
} ;
+
literal_expr: string
+
| TOK_NUMBER
+
| TOK_FLOAT { $$=mkfloatnode((FLOAT_TYPE)$1); }
+
| open_paren_with_line_info '{' expr_list close_brace_or_missing ')'
+
{
+
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
+
$$=mkefuncallnode("aggregate",$3);
+
COPY_LINE_NUMBER_INFO($$, $1);
+
free_node ($1);
+
}
+
| open_paren_with_line_info
+
open_bracket_with_line_info /* Only to avoid shift/reduce conflicts. */
+
m_expr_list close_bracket_or_missing ')'
+
{
+
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
+
$$=mkefuncallnode("aggregate_mapping",$3);
+
COPY_LINE_NUMBER_INFO($$, $1);
+
free_node ($1);
+
free_node ($2);
+
}
+
| TOK_MULTISET_START line_number_info expr_list TOK_MULTISET_END
+
{
+
/* FIXME: May eat lots of stack; cf Standards.FIPS10_4.divisions */
+
$$=mkefuncallnode("aggregate_multiset",$3);
+
COPY_LINE_NUMBER_INFO($$, $2);
+
free_node ($2);
+
}
+
| TOK_MULTISET_START line_number_info expr_list ')'
+
{
+
yyerror("Missing '>'.");
+
$$=mkefuncallnode("aggregate_multiset",$3);
+
COPY_LINE_NUMBER_INFO($$, $2);
+
free_node ($2);
+
}
+
| TOK_MULTISET_START line_number_info error TOK_MULTISET_END { $$=$2; yyerrok; }
+
| TOK_MULTISET_START line_number_info error ')' {
+
yyerror("Missing '>'.");
+
$$=$2; yyerrok;
+
}
+
| TOK_MULTISET_START line_number_info error TOK_LEX_EOF
+
{
+
$$=$2; yyerror("Missing '>)'.");
+
yyerror("Unexpected end of file.");
+
}
+
| TOK_MULTISET_START line_number_info error ';' { $$=$2; yyerror("Missing '>)'."); }
+
| TOK_MULTISET_START line_number_info error '}' { $$=$2; yyerror("Missing '>)'."); }
+
;
+
idents: low_idents | idents '.' TOK_IDENTIFIER {