aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-06 14:26:05 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-06 14:26:05 -0700
commit921a5d81d1c8a6edb35a0614049161901ef6ec74 (patch)
treeb0fc52bc8878b0120c1468dcbba577f23c4ec09d
parentd52f7f8a7b05c5b46fc99526cd8a6b2bf270bc85 (diff)
handle anonymous packed struct types
-rw-r--r--src/analyzer.js6
-rw-r--r--src/parseTools.js2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 6bee2da5..bcab0fad 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -129,12 +129,14 @@ function analyzer(data) {
}
// anonymous structure definition, for example |{ i32, i8*, void ()*, i32 }|
- if (type[0] == '{') {
+ if (type[0] == '{' || type[0] == '<') {
+ var packed = type[0] == '<';
Types.types[type] = {
name_: type,
- fields: splitTokenList(tokenize(type.substr(2, type.length-4)).tokens).map(function(segment) {
+ fields: splitTokenList(tokenize(type.substr(2 + packed, type.length - 4 - 2*packed)).tokens).map(function(segment) {
return segment[0].text;
}),
+ packed: packed,
lineNum: '?'
};
return;
diff --git a/src/parseTools.js b/src/parseTools.js
index 3d747aec..311f1f22 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -115,7 +115,7 @@ function isStructPointerType(type) {
function isStructType(type) {
if (isPointerType(type)) return false;
if (new RegExp(/^\[\d+\ x\ (.*)\]/g).test(type)) return true; // [15 x ?] blocks. Like structs
- if (new RegExp(/{ [^}]* }/g).test(type)) return true; // { i32, i8 } etc. - anonymous struct types
+ if (new RegExp(/<?{ [^}]* }>?/g).test(type)) return true; // { i32, i8 } etc. - anonymous struct types
// See comment in isStructPointerType()
return !Runtime.isNumberType(type) && type[0] == '%';
}