comparison trunk/src/dil/Parser.d @ 520:f203c5248d0b

Added 'compile' command. Fixes in config.d: changed 'auto' to 'var'; fixed format argument indices. dil.Lexer and dil.Parser add their errors to infoMan. Fix in enum TOK: Cent belongs to sublist of integral types.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 15 Dec 2007 22:25:18 +0100
parents 9ebc799c7dc5
children 39b497c76e2b
comparison
equal deleted inserted replaced
519:9ebc799c7dc5 520:f203c5248d0b
25 { 25 {
26 Lexer lx; 26 Lexer lx;
27 Token* token; /// Current non-whitespace token. 27 Token* token; /// Current non-whitespace token.
28 Token* prevToken; /// Previous non-whitespace token. 28 Token* prevToken; /// Previous non-whitespace token.
29 29
30 InformationManager infoMan;
30 ParserError[] errors; 31 ParserError[] errors;
31 32
32 ImportDeclaration[] imports; /// ImportDeclarations in the source text. 33 ImportDeclaration[] imports; /// ImportDeclarations in the source text.
33 34
34 LinkageType linkageType; 35 LinkageType linkageType;
45 text = the UTF-8 source code. 46 text = the UTF-8 source code.
46 filePath = the path to the source code; used for error messages. 47 filePath = the path to the source code; used for error messages.
47 +/ 48 +/
48 this(char[] srcText, string filePath, InformationManager infoMan = null) 49 this(char[] srcText, string filePath, InformationManager infoMan = null)
49 { 50 {
50 lx = new Lexer(srcText, filePath); 51 this.infoMan = infoMan;
52 lx = new Lexer(srcText, filePath, infoMan);
51 } 53 }
52 54
53 protected void init() 55 protected void init()
54 { 56 {
55 nT(); 57 nT();
4435 ++errorCount; 4437 ++errorCount;
4436 return; 4438 return;
4437 } 4439 }
4438 auto location = token.getLocation(); 4440 auto location = token.getLocation();
4439 auto msg = Format(_arguments, _argptr, formatMsg); 4441 auto msg = Format(_arguments, _argptr, formatMsg);
4440 errors ~= new ParserError(location, msg); 4442 auto error = new ParserError(location, msg);
4443 errors ~= error;
4444 if (infoMan !is null)
4445 infoMan ~= error;
4441 } 4446 }
4442 4447
4443 /// Collection of error messages with no MID yet. 4448 /// Collection of error messages with no MID yet.
4444 private struct MSG 4449 private struct MSG
4445 { 4450 {