|
@@ -157,13 +157,19 @@ exports.Real = ChainedContext.extend({
|
|
|
});
|
|
|
|
|
|
function escapeString(s){
|
|
|
+ var escapeChars = {"\\": "\\\\",
|
|
|
+ "\"": "\\\"",
|
|
|
+ "\n": "\\n",
|
|
|
+ "\r": "\\r",
|
|
|
+ "\t": "\\t",
|
|
|
+ "\b": "\\b",
|
|
|
+ "\f": "\\f"
|
|
|
+ };
|
|
|
var result = "\"";
|
|
|
for(var i = 0; i < s.length; ++i){
|
|
|
var c = s[i];
|
|
|
- if (c == '"')
|
|
|
- result += "\\\"";
|
|
|
- else
|
|
|
- result += s[i];
|
|
|
+ var escape = escapeChars[c];
|
|
|
+ result += escape !== undefined ? escape : c;
|
|
|
}
|
|
|
return result + "\"";
|
|
|
}
|
|
@@ -480,6 +486,12 @@ exports.FormalParametersProcDecl = exports.FormalParameters.extend({
|
|
|
exports.FormalParameters.prototype.addArgument.call(this, name, arg);
|
|
|
this.parent().addArgument(name, arg);
|
|
|
},
|
|
|
+ /*
|
|
|
+ handleSymbol: function(s){
|
|
|
+ exports.FormalParameters.prototype.handleSymbol.call(this, s);
|
|
|
+ this.parent().checkResultType(s);
|
|
|
+ },
|
|
|
+ */
|
|
|
endParse: function(){
|
|
|
exports.FormalParameters.prototype.endParse.call(this);
|
|
|
this.parent().endParameters();
|
|
@@ -534,6 +546,16 @@ exports.ProcDecl = ChainedContext.extend({
|
|
|
code.write(")");
|
|
|
code.openScope();
|
|
|
},
|
|
|
+ /*
|
|
|
+ checkResultType: function(s){
|
|
|
+ if (this.__id.exported()){
|
|
|
+ if (!s.scope().exports()[s.symbol().id()])
|
|
|
+ throw new Errors.Error(
|
|
|
+ "exported PROCEDURE '" + this.__id.id()
|
|
|
+ + "' uses non-exported type '" + s.symbol().id() + "'");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ */
|
|
|
handleReturn: function(type){
|
|
|
var result = this.__type.result();
|
|
|
if (!result)
|