aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-31 10:49:03 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-31 10:49:03 -0800
commit6856849cc520459fe9266ccaa84190b319eedadc (patch)
tree7538166e641e0c5aaaa42fd1c7bb1a7c3ceb0883 /src
parente97f48a2c9376354a6b8927191322322f13808ba (diff)
improve parsing of globals and types
Diffstat (limited to 'src')
-rw-r--r--src/intertyper.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 5af291c7..a5e6ccd9 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -69,11 +69,13 @@ function intertyper(data, sidePass, baseLineNums) {
if (mainPass && (line[0] == '%' || line[0] == '@')) {
// If this isn't a type, it's a global variable, make a note of the information now, we will need it later
- var testType = /[@%\w\d\.\" $-]+ = type .*/.exec(line);
+ var parts = line.split(' = ');
+ assert(parts.length >= 2);
+ var left = parts[0], right = parts.slice(1).join(' = ');
+ var testType = /^type .*/.exec(right);
if (!testType) {
- var global = /([@%\w\d\.\" $-]+) = .*/.exec(line);
- var globalIdent = toNiceIdent(global[1]);
- var testAlias = /[@%\w\d\.\" $-]+ = (hidden )?alias .*/.exec(line);
+ var globalIdent = toNiceIdent(left);
+ var testAlias = /^(hidden )?alias .*/.exec(right);
Variables.globals[globalIdent] = {
name: globalIdent,
alias: !!testAlias,