changeset 595:8370c4009cce

remove theme attributes
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 14 Sep 2015 14:20:52 -0600
parents e91e476186c7
children 6bb0c83116e9
files core/src/luan/impl/ThemeParser.java
diffstat 1 files changed, 1 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
diff -r e91e476186c7 -r 8370c4009cce core/src/luan/impl/ThemeParser.java
--- a/core/src/luan/impl/ThemeParser.java	Thu Sep 03 12:23:53 2015 -0600
+++ b/core/src/luan/impl/ThemeParser.java	Mon Sep 14 14:20:52 2015 -0600
@@ -182,7 +182,6 @@
 		String name = parseName();
 		if( name==null )
 			throw exception("invalid block name");
-		Map<String,String> attrs = parseAttrs();
 		String spaces = "";
 		if( BlankLine() ) {
 			while( BlankLine() );
@@ -192,8 +191,6 @@
 		}
 		if( !parser.match("}") )
 			return null;
-		if( !attrs.isEmpty() )
-			throw exception("this block should have no attributes");
 		Expr table = new GetLocalVar(null,stackIndex(MOD));
 		Settable fnName = new SetTableEntry(se(start),table,new ConstExpr(null,name));
 		frame = new Frame(frame);
@@ -319,7 +316,6 @@
 		String name = parseName();
 		if( name==null )
 			throw exception("invalid block name");
-		Map<String,String> attrs = parseAttrs();
 		if( !parser.match("}") )
 			return null;
 		frame = new Frame(frame);
@@ -332,7 +328,6 @@
 		Expr fn = new IndexExpr( se(start,"block:"+name), env, new ConstExpr(null,name) );
 		List<Expressions> args = new ArrayList<Expressions>();
 		args.add( env );
-		args.add( attrs.isEmpty() ? new ConstExpr(null,null) : table(attrs) );
 		args.add( fnDef );
 		FnCall fnCall = new FnCall( se(start), fn, ExpList.build(args) );
 		Stmt rtn = new ExpressionsStmt(fnCall);
@@ -346,7 +341,6 @@
 		String name = parseName();
 		if( name==null )
 			return parser.failure(null);
-		Map<String,String> attrs = parseAttrs();
 		Spaces();
 		if( !parser.match("}") )
 			return parser.failure(null);
@@ -370,52 +364,11 @@
 				}
 			};
 		}
-		List<Expressions> args = new ArrayList<Expressions>();
-		args.add( env );
-		if( !attrs.isEmpty() )
-			args.add( table(attrs) );
-		FnCall fnCall = new FnCall( se(start), fn, ExpList.build(args) );
+		FnCall fnCall = new FnCall( se(start), fn, env );
 		Stmt rtn = new ExpressionsStmt(fnCall);
 		return parser.success(rtn);
 	}
 
-	private TableExpr table(Map<String,String> attrs) {
-		List<TableExpr.Field> fields = new ArrayList<TableExpr.Field>();
-		for( Map.Entry<String,String> entry : attrs.entrySet() ) {
-			ConstExpr key = new ConstExpr(null,entry.getKey());
-			ConstExpr value = new ConstExpr(null,entry.getValue());
-			fields.add( new TableExpr.Field(key,value) );
-		}
-		return new TableExpr( null, fields.toArray(new TableExpr.Field[0]), ExpList.emptyExpList );
-	}
-
-	private Map<String,String> parseAttrs() {
-		Map<String,String> attrs = new HashMap<String,String>();
-		while( parseAttr(attrs) );
-		return attrs;
-	}
-
-	private boolean parseAttr(Map<String,String> attrs) {
-		parser.begin();
-		Spaces();
-		String name = parseName();
-		if( name==null )
-			return parser.failure();
-		Spaces();
-		if( !parser.match('=') )
-			return parser.failure();
-		Spaces();
-		if( !parser.match('"') )
-			return parser.failure();
-		int start = parser.currentIndex();
-		while( parser.noneOf("\"}") );
-		String val = parser.textFrom(start);
-		if( !parser.match('"') )
-			return parser.failure();
-		attrs.put(name,val);
-		return parser.success();
-	}
-
 	private void Spaces() {
 		while( parser.anyOf(" \t\r\n") );
 	}