Grammar Testing

Unit testing is the best way I've found to really develop a grammar. It allows you to focus on very specific pieces of the grammar at a time, then later put it all together by parsing an entire document.

This library depends upon php-tests for testing.

Links:

Howto

  1. Extend \Tlf\Lexer\Test\Tester which extends from \Tlf\Tester or copy the methods from it & modify as needed for a different testing library.
  2. Implement a testGrammarName() method that uses the test runner
  3. Implement the data structure for defining the unit tests.

Example of 2.:

public function testPhpDirectives() {  
Cannot find 'body' part of 'methods.testPhpDirectives.body' on 'Tlf\Lexer\Test\PhpGrammar'. You may try one of: type, modifiers, docblock, name, definition, arglist  
}  

Example of 3.:
-- whatever goes here