Hoa central
Public Member Functions | List of all members
Hoa\Compiler\Test\Unit\Llk\Llk Class Reference
Inheritance diagram for Hoa\Compiler\Test\Unit\Llk\Llk:

Public Member Functions

 case_without_unification ()
 
 case_unification ()
 
 case_unification_palindrome ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the examples in the documentation.

Definition at line 51 of file Llk.php.

Member Function Documentation

Hoa\Compiler\Test\Unit\Llk\Llk::case_unification ( )

Definition at line 90 of file Llk.php.

91  {
92  $_grammar = <<<GRAMMAR
93 %token quote '|"
94 %token string \w+
95 
96 rule:
97  ::quote[0]:: <string> ::quote[0]::
98 GRAMMAR;
99 
100  $this
101  ->given(
102  $grammar = new File\ReadWrite('hoa://Test/Vfs/Unification.pp'),
103  $grammar->writeAll($_grammar),
104  $compiler = LUT\Llk::load($grammar)
105  )
106  ->when($result = $compiler->parse('"foo"', null, false))
107  ->then
108  ->boolean($result)
109  ->isTrue()
110 
111  ->when($result = $compiler->parse('\'foo\'', null, false))
112  ->then
113  ->boolean($result)
114  ->isTrue()
115 
116  ->exception(function () use (&$compiler) {
117 
118  $compiler->parse('\'foo"', null, false);
119  })
120  ->isInstanceOf('Hoa\Compiler\Exception\UnexpectedToken')
121 
122  ->exception(function () use (&$compiler) {
123 
124  $compiler->parse('"foo\'', null, false);
125  })
126  ->isInstanceOf('Hoa\Compiler\Exception\UnexpectedToken');
127  }
you have Consistency php Event php Exception php Parameter php Protocol php Data php SUCCEED FAILED … __hoa_core_fill DS PS CRLF OS_WIN PHP_WINDOWS_VERSION_PLATFORM S_64_BITS S_32_BITS PHP_INT_MIN PHP_FLOAT_MIN PHP_FLOAT_MAX π void _public _protected _private _static _abstract _pure _final _dynamic _concrete _overridable WITH_COMPOSER Composer Autoload ClassLoader cli autoload php suhosin The URL scheme hoa
Definition: Core.php:160
Hoa\Compiler\Test\Unit\Llk\Llk::case_unification_palindrome ( )

Definition at line 129 of file Llk.php.

130  {
131  $_grammar = <<<GRAMMAR
132 %token t \w
133 
134 root:
135  ::t[0]:: root()? ::t[0]::
136 GRAMMAR;
137 
138  $this
139  ->given(
140  $grammar = new File\ReadWrite('hoa://Test/Vfs/Palindrome.pp'),
141  $grammar->writeAll($_grammar),
142  $compiler = LUT\Llk::load($grammar)
143  )
144  ->when($result = $compiler->parse('aa', null, false))
145  ->then
146  ->boolean($result)
147  ->isTrue()
148 
149  ->when($result = $compiler->parse('abba', null, false))
150  ->then
151  ->boolean($result)
152  ->isTrue()
153 
154  ->when($result = $compiler->parse('abccba', null, false))
155  ->then
156  ->boolean($result)
157  ->isTrue()
158 
159  ->when($result = $compiler->parse('abcddcba', null, false))
160  ->then
161  ->boolean($result)
162  ->isTrue()
163 
164  ->exception(function () use (&$compiler) {
165 
166  $compiler->parse('abcdcba', null, false);
167  })
168  ->isInstanceOf('Hoa\Compiler\Exception\UnexpectedToken');
169  }

Here is the call graph for this function:

Hoa\Compiler\Test\Unit\Llk\Llk::case_without_unification ( )

Definition at line 53 of file Llk.php.

54  {
55  $_grammar = <<<GRAMMAR
56 %token quote '|"
57 %token string \w+
58 
59 rule:
60  ::quote:: <string> ::quote::
61 GRAMMAR;
62 
63  $this
64  ->given(
65  $grammar = new File\ReadWrite('hoa://Test/Vfs/WithoutUnification.pp'),
66  $grammar->writeAll($_grammar),
67  $compiler = LUT\Llk::load($grammar)
68  )
69  ->when($result = $compiler->parse('"foo"', null, false))
70  ->then
71  ->boolean($result)
72  ->isTrue()
73 
74  ->when($result = $compiler->parse('\'foo"', null, false))
75  ->then
76  ->boolean($result)
77  ->isTrue()
78 
79  ->when($result = $compiler->parse('"foo\'', null, false))
80  ->then
81  ->boolean($result)
82  ->isTrue()
83 
84  ->when($result = $compiler->parse('\'foo\'', null, false))
85  ->then
86  ->boolean($result)
87  ->isTrue();
88  }
you have Consistency php Event php Exception php Parameter php Protocol php Data php SUCCEED FAILED … __hoa_core_fill DS PS CRLF OS_WIN PHP_WINDOWS_VERSION_PLATFORM S_64_BITS S_32_BITS PHP_INT_MIN PHP_FLOAT_MIN PHP_FLOAT_MAX π void _public _protected _private _static _abstract _pure _final _dynamic _concrete _overridable WITH_COMPOSER Composer Autoload ClassLoader cli autoload php suhosin The URL scheme hoa
Definition: Core.php:160

The documentation for this class was generated from the following file: