diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-01-15 14:44:12 (GMT) |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-01-15 14:44:12 (GMT) |
commit | 20dd0ee74d288e0630b5522231e5118153693e0f (patch) | |
tree | ef0d2f882f007d37c27d9d8d8fdca20758e0e1fa /src/declarative/qml/parser | |
parent | 1a6127b865baf48f45aba2166fd15ac3e4b079ec (diff) | |
download | Qt-20dd0ee74d288e0630b5522231e5118153693e0f.zip Qt-20dd0ee74d288e0630b5522231e5118153693e0f.tar.gz Qt-20dd0ee74d288e0630b5522231e5118153693e0f.tar.bz2 |
Added utility method to parse single/stand-alone JS source elements.
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r-- | src/declarative/qml/parser/qmljs.g | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index 70cf06a..05e7942 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -92,6 +92,7 @@ %token T_FEED_UI_OBJECT_MEMBER %token T_FEED_JS_STATEMENT %token T_FEED_JS_EXPRESSION +%token T_FEED_JS_SOURCE_ELEMENT %nonassoc SHIFT_THERE %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY @@ -287,6 +288,7 @@ public: bool parse() { return parse(T_FEED_UI_PROGRAM); } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } + bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } AST::UiProgram *ast() const @@ -561,6 +563,14 @@ case $rule_number: { } break; ./ +TopLevel: T_FEED_JS_SOURCE_ELEMENT Expression ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember ; /. case $rule_number: { @@ -3031,7 +3041,8 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || - tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || + tk == T_FEED_JS_SOURCE_ELEMENT) continue; int a = t_action(errorState, tk); |