-
Notifications
You must be signed in to change notification settings - Fork 2
/
LexerTest.php
38 lines (35 loc) · 1.04 KB
/
LexerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>This is where the Lexer fails miserably.</title>
</head>
<body>
<?php
include('PostLexer.class.php');
echo "<h1>Terminals used:</h1>\n";
echo "<pre>\n";
print_r(PostLexer::get_terms());
echo "</pre>\n";
$tests = array(
'This is a regular comment. There is nothing fancy about it.',
'(code) if(true) { echo "dongs"; } (code)',
'This is (italic cool) text.',
'This is a (bold neato) addition to the lexer.',
'This is a regular comment, except with a quote. (quote 123)',
"This cites an article. (cite \"u're mum's a fag xdd\" dinmor.dk)",
"This also cites stuff. (cite 'i caem @ ure butt :))' bbc.co.uk)",
'This is (code)(print "dongs")(code) inline code.'
);
foreach($tests as $test) {
echo '<h2>' . $test . '</h2>' . "\n";
echo "<pre>\n";
$lex = PostLexer::run(array($test));
print_r($lex);
echo "</pre>\n";
echo "<h3>This is the HTML:</h3>\n";
echo PostLexer::parseString($test);
echo "<hr />\n";
}
?>
</body>
</html>