/*
  This is a TextX specification of pyFlies DSL for Reaction Time test
  experiments definition.
  Author: Igor R. Dejanovic <igor DOT dejanovic AT gmail DOT com>
  Copyright: (c) 2014 Igor R. Dejanovic <igor DOT dejanovic AT gmail DOT com>
  License: MIT License
*/

PyFliesModel:
  elements+=ModelElement
;

ModelElement:
  TestDef|Experiment
;

TestDef:
  "test" name=ID (":" test_type=TestType)? ( "<" inherits*={[TestDef] ","} )? "{"
    TestParam*
  "}"
;

TestType:
  name=ID
;

TestParam:
  name=ID value=(ID|FLOAT|INT|STRING)
;

/* TestParamValue: */
/*   (value=ID|FLOAT|INT|STRING)|( '[' value+={ID ","} ']') */
/* ; */

TestParamLabel:
  label = STRING
;


Block:
  Intro|Test|Sequence|Randomize|Subject
;

Experiment:
  'experiment' '{'
    blocks=Block*
  '}'
;

Sequence:
  'sequence' '{'
    blocks=Block*
  '}'
;

Randomize:
  'randomize' '{'
    blocks=Block*
  '}'
;

Test:
  'test' type=[TestDef] practice?="practice"
;

Intro:
  /====*/
  content=/([^=][^=]?[^=]?)*/
  /====*/
;

Subject:
  'subject' '{'
    attribute+=SubjectAttribute
  '}'
;

SubjectAttribute:
  name=ID type=("int"|"string"|"float"|Enum)  label=STRING?
;

Enum:
  '[' values+={ID ','} ']'
;

// Special rule for comments
Comment:
  /#.*$/
;