Mercurial Hosting > luan
comparison src/luan/interp/LuanParser.java @ 139:3b384dc5ca91
replace WebShell.java with web_shell.luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@140 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 13 Jun 2014 12:26:44 +0000 |
parents | 573ce091ae00 |
children | dfd0f33b584e |
comparison
equal
deleted
inserted
replaced
138:06159094b802 | 139:3b384dc5ca91 |
---|---|
421 | 421 |
422 private List<String> RequiredNameList(In in) throws ParseException { | 422 private List<String> RequiredNameList(In in) throws ParseException { |
423 parser.begin(); | 423 parser.begin(); |
424 List<String> names = NameList(in); | 424 List<String> names = NameList(in); |
425 if( names==null ) | 425 if( names==null ) |
426 parser.exception("Name expected"); | 426 throw parser.exception("Name expected"); |
427 return parser.success(names); | 427 return parser.success(names); |
428 } | 428 } |
429 | 429 |
430 private List<String> NameList(In in) throws ParseException { | 430 private List<String> NameList(In in) throws ParseException { |
431 String name = Name(in); | 431 String name = Name(in); |
432 if( name==null ) | 432 if( name==null ) |
433 return null; | 433 return null; |
434 List<String> names = new ArrayList<String>(); | 434 List<String> names = new ArrayList<String>(); |
435 names.add(name); | 435 names.add(name); |
436 while( parser.match( ',' ) ) { | 436 while( (name=anotherName(in)) != null ) { |
437 Spaces(in); | 437 names.add(name); |
438 names.add( RequiredName(in) ); | |
439 } | 438 } |
440 return names; | 439 return names; |
440 } | |
441 | |
442 private String anotherName(In in) throws ParseException { | |
443 parser.begin(); | |
444 if( !parser.match( ',' ) ) | |
445 return parser.failure(null); | |
446 Spaces(in); | |
447 String name = Name(in); | |
448 if( name==null ) | |
449 return parser.failure(null); | |
450 return parser.success(name); | |
441 } | 451 } |
442 | 452 |
443 private Stmt WhileStmt() throws ParseException { | 453 private Stmt WhileStmt() throws ParseException { |
444 parser.begin(); | 454 parser.begin(); |
445 if( !Keyword("while",In.NOTHING) ) | 455 if( !Keyword("while",In.NOTHING) ) |
1002 | 1012 |
1003 private String RequiredName(In in) throws ParseException { | 1013 private String RequiredName(In in) throws ParseException { |
1004 parser.begin(); | 1014 parser.begin(); |
1005 String name = Name(in); | 1015 String name = Name(in); |
1006 if( name==null ) | 1016 if( name==null ) |
1007 parser.exception("Name expected"); | 1017 throw parser.exception("Name expected"); |
1008 return parser.success(name); | 1018 return parser.success(name); |
1009 } | 1019 } |
1010 | 1020 |
1011 private String Name(In in) throws ParseException { | 1021 private String Name(In in) throws ParseException { |
1012 int start = parser.begin(); | 1022 int start = parser.begin(); |