comparison core/src/luan/impl/LuanParser.java @ 179:bf9c7111a371

minor git-svn-id: https://luan-java.googlecode.com/svn/trunk@180 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 24 Jun 2014 00:05:53 +0000
parents bdbd4740121f
children 5351374efb6d
comparison
equal deleted inserted replaced
178:2c08e7e27a70 179:bf9c7111a371
343 343
344 private Stmt ImportStmt() throws ParseException { 344 private Stmt ImportStmt() throws ParseException {
345 int start = parser.begin(); 345 int start = parser.begin();
346 if( !Keyword("import",In.NOTHING) ) 346 if( !Keyword("import",In.NOTHING) )
347 return parser.failure(null); 347 return parser.failure(null);
348 Expr importExpr = (Expr)nameVar(start,"require").expr(); 348 Expr importExpr;
349 {
350 LuanSource.Element se = se(start);
351 int index = stackIndex("require");
352 if( index != -1 ) {
353 importExpr = new GetLocalVar(se,index);
354 } else {
355 index = upValueIndex("require");
356 if( index != -1 ) {
357 importExpr = new GetUpVar(se,index);
358 } else {
359 throw parser.exception("no local 'require' function, needed for import");
360 }
361 }
362 }
349 String modName = StringLiteral(In.NOTHING); 363 String modName = StringLiteral(In.NOTHING);
350 if( modName==null ) 364 if( modName==null )
351 return parser.failure(null); 365 return parser.failure(null);
352 int i = modName.lastIndexOf('/'); 366 int i = modName.lastIndexOf('/');
353 if( i == -1 ) 367 if( i == -1 )