diff lex.rhope @ 132:1f238280047f

Some work on expression parsing in new parser
author Mike Pavone <pavone@retrodev.com>
date Fri, 05 Nov 2010 01:23:25 -0400
parents 0a4682be2db2
children 386f4a874821
line wrap: on
line diff
--- a/lex.rhope	Fri Nov 05 02:43:34 2010 +0000
+++ b/lex.rhope	Fri Nov 05 01:23:25 2010 -0400
@@ -170,7 +170,29 @@
 			{
 				next list <- Val[token list]
 			}{
-				next list <- [token list]Append[Token["Symbol", trimmed, trimmed]]
+				If[[trimmed]=["?"]]
+				{
+					token type <- "Arg Placeholder"
+				}{
+					If[[trimmed]=["~"]]
+					{
+						token type <- "Block Reference"
+					}{
+						If[[trimmed]Ends With[">>"]]
+						{
+							next list <- [token list]Append[Token["Field Get", trimmed, Trim[[trimmed]Slice[ [[trimmed]Length]-[2] ], " \t\r\n"] ]]
+						}{
+							If[[trimmed]Ends With["<<"]]
+							{
+								next list <- [token list]Append[Token["Field Set", trimmed, Trim[[trimmed]Slice[ [[trimmed]Length]-[2] ], " \t\r\n"] ]]
+							}{
+								token type <- "Symbol"
+							}
+							
+						}
+					}
+				}
+				next list <- [token list]Append[Token[token type, trimmed, trimmed]]
 			}
 			out <- [token worker]Call[simple tokens, next list]
 		}
@@ -181,7 +203,7 @@
 
 Lex[text:out]
 {
-	simple tokens <- [[[[[[[[[[[Dictionary[]
+	simple tokens <- [[[[[[[[[[Dictionary[]
 		]Set["{", "Block Begin"]
 		]Set["}", "Block End"]
 		]Set["(", "List Begin"]
@@ -191,7 +213,7 @@
 		]Set[",", "List Separator"]
 		]Set[":", "Name Separator"]
 		]Set["@", "Method Separator"]
-		]Set["`", "Binary Operation"]
 		]Set["\n", "Newline"]
 	out <- _Lex[text, [text]Slice[0], simple tokens, ()]
 }
+