Differences From Artifact [42c980cf31500e88]:
- File
polemy/parse.d
- 2010-11-09 15:35:18 - part of checkin [a5d10ace51] on branch trunk - FizzBuzz! (user: kinaba) [annotate]
To Artifact [2739b95337ae2aab]:
- File
polemy/parse.d
- 2010-11-10 12:38:54 - part of checkin [38fcc662be] on branch trunk - cleaned up documentation comments (user: kinaba) [annotate]
5 5 * Parser for Polemy programming language
6 6 */
7 7 module polemy.parse;
8 8 import polemy._common;
9 9 import polemy.lex;
10 10 import polemy.ast;
11 11
12 -/// Exception from this module
13 -
12 +///
14 13 class ParseException : Exception
15 14 {
16 15 mixin ExceptionWithPosition;
17 16 }
18 17
19 18 /// Entry points of this module
20 19
21 -auto parseString(S, T...)(S str, T fn_ln_cn)
20 +AST parseString(S, T...)(S str, T fn_ln_cn)
22 21 { return parserFromString(str, fn_ln_cn).parse(); }
23 22
24 -auto parseFile(S, T...)(S filename, T ln_cn)
23 +/// Entry points of this module
24 +
25 +AST parseFile(S, T...)(S filename, T ln_cn)
25 26 { return parserFromFile(filename, ln_cn).parse(); }
26 27
27 -/// Named Constructor of Parser
28 +// Named Constructors of Parser
28 29
29 30 private auto parserFromLexer(Lexer)(Lexer lex)
30 31 { return new Parser!Lexer(lex); }
31 32
32 33 private auto parserFromString(T...)(T params)
33 34 { return parserFromLexer(polemy.lex.lexerFromString(params)); }
34 35
35 36 private auto parserFromFile(T...)(T params)
36 37 { return parserFromLexer(polemy.lex.lexerFromFile(params)); }
37 38
38 -/// Parser
39 +// Parser
39 40
40 41 private class Parser(Lexer)
41 42 if( isForwardRange!(Lexer) && is(ElementType!(Lexer) == Token) )
42 43 {
43 44 AST parse()
44 45 {
45 46 auto e = Body();