mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-01 22:56:17 +00:00
Handle preprocessor lines like "#pragma"
This commit is contained in:
@@ -728,5 +728,10 @@ ObjectExpression: function(node, st, c) {
|
||||
}
|
||||
c(prop.value, st, "Expression");
|
||||
}
|
||||
},
|
||||
PreprocessStatement: function(node, st, c) {
|
||||
CONCAT(st.compiler.jsBuffer, st.compiler.source.substring(st.compiler.lastPos, node.start));
|
||||
st.compiler.lastPos = node.start;
|
||||
CONCAT(st.compiler.jsBuffer, "//");
|
||||
}
|
||||
});
|
||||
|
||||
+15
-2
@@ -531,8 +531,6 @@ if (!exports.acorn) {
|
||||
++tokPos;
|
||||
} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
|
||||
++tokPos;
|
||||
} else if (ch === 35 && options.objj) {
|
||||
skipLineComment(1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -699,6 +697,16 @@ if (!exports.acorn) {
|
||||
return readToken_at(code);
|
||||
return false;
|
||||
|
||||
case 35: // '#'
|
||||
if (options.objj) {
|
||||
var start = tokPos;
|
||||
var ch = input.charCodeAt(++tokPos);
|
||||
while (tokPos < inputLen && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8329) // End of line
|
||||
ch = input.charCodeAt(++tokPos);
|
||||
return finishToken(_preprocess, input.slice(start, tokPos));
|
||||
}
|
||||
return false;
|
||||
|
||||
case 126: // '~'
|
||||
return finishOp(_prefix, 1);
|
||||
}
|
||||
@@ -1359,6 +1367,11 @@ if (!exports.acorn) {
|
||||
node.filename = parseStringNumRegExpLiteral();
|
||||
return finishNode(node, "ImportStatement");
|
||||
|
||||
// This is a Objective-J statement
|
||||
case _preprocess:
|
||||
next();
|
||||
return finishNode(node, "PreprocessStatement");
|
||||
|
||||
// If the statement does not start with a statement keyword or a
|
||||
// brace, it's an ExpressionStatement or LabeledStatement. We
|
||||
// simply start parsing an expression, and afterwards, if the
|
||||
|
||||
@@ -202,6 +202,8 @@ if (!exports.acorn) {
|
||||
|
||||
exports.MethodDeclarationStatement = ignore;
|
||||
|
||||
exports.PreprocessStatement = ignore;
|
||||
|
||||
exports.MethodDeclarationStatement = function(node, st, c) {
|
||||
c(node.body, st, "Statement");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user