[chaining-with-comma
strick**20120130075336
 Ignore-this: 497f10f1c5bb136299301d25a5a94c00
] hunk ./ExprTest.java 147
-				+ "   [ a gt: 0 ] run ye: [ g@  [ / triangle [ a mi: 1 ] run ] run pl: a  ] . "
+//				+ "   [ a gt: 0 ] run ye: [ g@  [ / triangle [ a mi: 1 ] run ] run pl: a  ] . "
+				+ "   [ a gt: 0 ] run ye: [ g@   / triangle [ a mi: 1 ] run , pl: a  ] . "
hunk ./Parser.java 21
+	static Pattern almostKeywordP;
hunk ./Parser.java 25
-		instVarP = Pattern.compile("/[a-z][a-z_]*", Pattern.CASE_INSENSITIVE);
-		localIdentP = Pattern.compile("[a-z][a-z_0-9]?", Pattern.CASE_INSENSITIVE);
+		instVarP = Pattern
+				.compile("/[a-z][a-z_0-9]*", Pattern.CASE_INSENSITIVE);
+		localIdentP = Pattern.compile("[a-z][a-z_0-9]?",
+				Pattern.CASE_INSENSITIVE);
hunk ./Parser.java 43
-		multiKeywordP = Pattern.compile("([a-z][a-z_0-9]([a-z_0-9][a-z_0-9])*[:])+",
-				Pattern.CASE_INSENSITIVE);  // Colons required in multi form.
+		almostKeywordP = Pattern.compile("[a-z][a-z_0-9:]*[:][a-z_0-9:]*",
+				Pattern.CASE_INSENSITIVE); // Contains at least a colon.
+		multiKeywordP = Pattern.compile(
+				"([a-z][a-z_0-9]([a-z_0-9][a-z_0-9])*[:])+",
+				Pattern.CASE_INSENSITIVE); // Colons required in multi form.
hunk ./Parser.java 111
-			Expr cascade = parseCascade();
+			Expr cascade = parseChain();
hunk ./Parser.java 123
-			return parseCascade();
+			return parseChain();
hunk ./Parser.java 126
-	Expr parseCascade() {
-		return parseKeyed();
+	Expr parseChain() {
+		// Normal SmallTalk "cascades" using ";", but we don't.
+		// Instead we "chain" with ",".
+		// Whereas cascade sends subsequent messages to the same receiver,
+		// this chaining sends subsequent messages to the previous result..
+		say("ParseChain: entry: %s", x.w);
+		Expr expr = parseKeyed(null); // parseKeyed should parse an initial
+		// receiver..
+		say("ParseChain: pre-entry-expr: %s", expr);
+		say("ParseChain: pre-while: %s", x.w);
+		while (x.w.equals(",")) {
+			x.advance();
+			say("ParseChain: in-while-advanced: %s", x.w);
+			expr = parseKeyed(expr); // parseKeyed uses our expr as the
+			// receiver.
+
+			say("ParseChain: in-while-expr: %s", expr);
+		}
+		say("ParseChain: return-expr: %s", expr);
+		return expr;
hunk ./Parser.java 147
-	Expr parseKeyed() {
-		Expr receiver = parseUnary();
+	Expr parseKeyed(Expr receiver) {
+		if (receiver == null) {
+			receiver = parseUnary();
+		}
hunk ./Parser.java 165
+		if (almostKeywordP.matcher(x.w).matches()) {
+			// Common error in number of chars with colons.
+			toss("Suspicious token, looks like a keyword, but isn't: <%s>", x.w);
+		}
hunk ./Parser.java 210
+		} else if (keywordP.matcher(w).matches()) {
+			toss(
+					"Misplaced keyword, was expecting a variable or literal or block: <%s>",
+					w);
+		} else if (almostKeywordP.matcher(w).matches()) {
+			toss(
+					"Misplaced thing that looks sort of like a keyword, was expecting a variable or literal or block: <%s>",
+					w);
hunk ./Parser.java 227
-		// TODO: Parse arg var names.
hunk ./Parser.java 252
-
-	public static void main(String a[]) {
-		Scanner s = new Scanner("main ( 8 , 5) (foo bar);");
-		while (s.hasNext()) {
-			System.out.println("Scanner: <" + s.next() + ">");
-		}
-
-		Lex x = new Lex("main ( 8 , 5) (foo bar);");
-		while (x.w != null) {
-			System.out.println("Lex: <" + x.w + ">");
-			x.advance();
-		}
-
-		Terp t = new Terp();
-		// System.out.println("-> " + parse(t, "888"));
-		// System.out.println("-> " + parse(t, " 'foo' "));
-		// System.out.println("-> " + parse(t, "a/ b"));
-		System.out.println("-> " + parse(t, " . 23 . 42 . . . "));
-	}