Hi,
On 18/05/10 11:02 PM, "Kamm Christian.D (Nokia-D/Berlin)" <christian.d.k...@nokia.com> wrote: > I think it'd be good to have an annotated grammar of the Qml language in the > documentation. The current way of teaching by example is great for new users. > It isn't very good as a quick reference, a reliable way to resolve corner > cases or to figure out whether something is valid Qml. Great! I've started on this a number of times, but never really got anywhere before being distracted. Perhaps someone with more discipline will have more luck. > QmlProgram: > QmlImport* QmlObjectDefinition > > QmlImport: > 'import' QmlImportId QmlImportVersion ('as' QmlIdentifier)? > 'import' StringLiteral QmlImportVersion? ('as' QmlIdentifier)? > > QmlImportId: > IdentifierName ('.' IdentifierName)* > > The implemented grammar just says "QmlImportId: MemberExpression" and has an > extra check to verify it's either a string literal or a series of > FieldMemberExpressions in the parsing code. I think this should be explicit in > the documentation. It may also be worthwhile to change the grammar like this > to allow using reserved words for qualified imports. Agreed. > QmlImportVersion: > DecimalIntegerLiteral '.' DecimalDigits > > The implemented grammar uses NumericLiteral here. Being more explicit shows > that 1.5e9 is not a valid import version more clearly. Sure, if you're happy to type "import Qt 4.1500000000" in another 1499999993 releases of Qt :) Ok, DecimalDigits makes more sense. > QmlObjectMember: > QmlPropertyDeclaration > QmlPropertyBinding > QmlObjectDefinition > QmlSignalDeclaration > FunctionDeclaration > > Omitted VarDeclaration. Do you mean the "UiObjectMember: VariableStatement" clause? I think that should be removed. Roberto? > QmlPropertyDeclaration: > 'property' QmlPropertyType QmlIdentifier (':' QmlPropertyRhs)? > 'property' 'list' '<' QmlQualifiedId '>' (':' '[' QmlArrayMemberList? > ']')? > 'default' 'property' 'alias' QmlIdentifier ':' QmlPropertyRhs > > This is different from the implemented grammar in several ways. > > 1. It allows any right-hand side that's valid in a property binding as the > initializer of a declaration. While separating the two may make sense to > programmers, what's the harm in making > > property int foo : 3*width > > be equivalent to the following: > > property int foo > foo: 3*width It *should* be the same. I thought this had been fixed, but I guess not :( > 2. I changed the list type from list<QmlIdentifier> to list<QmlQualifiedId> to > allow lists of types that have been imported into a namespace. This seems to > be an oversight in the current implementation. Yep > 3. is there any use for 'default' properties that don't have 'alias' type? I > couldn't think of any and altered the grammar accordingly. Object and list properties can be default. "default property Object blah" for example. > QmlPropertyType: > QmlIdentifier > > I dropped ReservedWord and 'var'. The latter is deprecated and no Qml types > seem to be reserved words. Ok. > I'll open tickets for these bugs/suggestions in a few days, depending on the > feedback. Please do. Cheers, Aaron _______________________________________________ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml