Skip to content

Instantly share code, notes, and snippets.

@kthoms
Last active December 12, 2015 10:19
Show Gist options
  • Save kthoms/4758255 to your computer and use it in GitHub Desktop.
Save kthoms/4758255 to your computer and use it in GitHub Desktop.
LWC13: QlDsl.xtext, Step 1
grammar org.eclipse.xtext.example.ql.QlDsl with org.eclipse.xtext.xbase.Xbase
generate qlDsl "http://www.eclipse.org/xtext/example/ql/QlDsl"
/* The top-most container of QL files is a Questionnaire */
Questionnare:
imports+=Import*
forms+=Form*;
/* Allows importing of qualified names of types */
Import:
'import' importedNamespace=QualifiedName;
/* QL consists of questions grouped in a top-level form construct. */
Form:
"form" name=ID "{"
element += FormElement*
"}";
/* Abstract rule for elements contained in a Form */
FormElement:
Question
;
/**
* - Each question identified by a name that at the same time represents the result of the question.
* - A question has a label that contains the actual question text presented to the user.
* - Every question has a type.
*/
Question:
name=ID ":" label=STRING type=JvmTypeReference
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment