bug fix
This commit is contained in:
parent
e5d3cb56c0
commit
e6a49779ae
22
README.md
22
README.md
|
|
@ -384,6 +384,18 @@ Future plans
|
|||
|
||||
- static typing
|
||||
- rename runtime prefix `$_cola` to `_crt$$`
|
||||
- inline using of `@use`
|
||||
|
||||
@use meteor
|
||||
@use strict
|
||||
|
||||
@use closure
|
||||
|
||||
// or you can...
|
||||
|
||||
@use meteor strict closure
|
||||
|
||||
|
||||
- dotal names of refs
|
||||
|
||||
String String::replaceAll(a, b){
|
||||
|
|
@ -484,10 +496,6 @@ Future plans
|
|||
|
||||
- ES6 `for`
|
||||
|
||||
for({String name, String login, String photoUrl} in usesr){
|
||||
|
||||
}
|
||||
|
||||
for(name of names){
|
||||
|
||||
}
|
||||
|
|
@ -506,9 +514,9 @@ Future plans
|
|||
this; // parent context
|
||||
});
|
||||
|
||||
- namespaces
|
||||
- namespaces, name of namespace must be cupitalized
|
||||
|
||||
@use namespace Cola {
|
||||
@use Cola {
|
||||
|
||||
class AST_Node {
|
||||
...
|
||||
|
|
@ -549,7 +557,7 @@ Future plans
|
|||
}
|
||||
});
|
||||
|
||||
- Compiler command `@use plugin "path/to/plugin.cola"`
|
||||
- Compiler command `@use pluginname` , pluginname must be in lower case.
|
||||
- asm.js native syntax, for example
|
||||
|
||||
// cola
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
102
lib/parse.js
102
lib/parse.js
|
|
@ -79,51 +79,51 @@ Cola.RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;
|
|||
Cola.RE_OCT_NUMBER = /^0[0-7]+$/;
|
||||
Cola.RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
|
||||
|
||||
Cola.OPERATORS = [
|
||||
"in",
|
||||
"instanceof",
|
||||
"typeof",
|
||||
"new",
|
||||
//"void",
|
||||
"delete",
|
||||
"++",
|
||||
"--",
|
||||
"+",
|
||||
"-",
|
||||
"!",
|
||||
"~",
|
||||
"&",
|
||||
"|",
|
||||
"^",
|
||||
"*",
|
||||
"/",
|
||||
"%",
|
||||
">>",
|
||||
"<<",
|
||||
">>>",
|
||||
"<",
|
||||
">",
|
||||
"<=",
|
||||
">=",
|
||||
"==",
|
||||
"===",
|
||||
"!=",
|
||||
"!==",
|
||||
"?",
|
||||
"=",
|
||||
"+=",
|
||||
"-=",
|
||||
"/=",
|
||||
"*=",
|
||||
"%=",
|
||||
">>=",
|
||||
"<<=",
|
||||
">>>=",
|
||||
"|=",
|
||||
"^=",
|
||||
"&=",
|
||||
"&&",
|
||||
"||",
|
||||
Cola.OPERATORS = [ // d - different left and right types of vars, s - same
|
||||
"in", // binary - d
|
||||
"instanceof", // binary - d
|
||||
"typeof", // unary - dynamic
|
||||
"new", // unary
|
||||
//"void", // unary
|
||||
"delete", // unary - dynamic
|
||||
"++", // unary - Number
|
||||
"--", // unary - Number
|
||||
"+", // binary/unary - s
|
||||
"-", // binary/unary - s
|
||||
"!", // unary - Boolean
|
||||
"~", // unary - Number
|
||||
"&", // binary - s
|
||||
"|", // binary - s
|
||||
"^", // binary - s
|
||||
"*", // binary - s
|
||||
"/", // binary - s
|
||||
"%", // binary - s
|
||||
">>", // binary - s
|
||||
"<<", // binary - s
|
||||
">>>", // binary - s
|
||||
"<", // binary - s
|
||||
">", // binary - s
|
||||
"<=", // binary - s
|
||||
">=", // binary - s
|
||||
"==", // binary - s
|
||||
"===", // binary - s, without checking of types!
|
||||
"!=", // binary - s
|
||||
"!==", // binary - s, without checking of types!
|
||||
"?", // ternary?
|
||||
"=", // binary - d|s
|
||||
"+=", // binary - d|s
|
||||
"-=", // binary - d|s
|
||||
"/=", // binary - d|s
|
||||
"*=", // binary - d|s
|
||||
"%=", // binary - d|s
|
||||
">>=", // binary - d|s
|
||||
"<<=", // binary - d|s
|
||||
">>>=", // binary - d|s
|
||||
"|=", // binary - d|s
|
||||
"^=", // binary - d|s
|
||||
"&=", // binary - d|s
|
||||
"&&", // binary - s
|
||||
"||", // binary - s
|
||||
// ColaScript
|
||||
"clone",
|
||||
"isset",
|
||||
|
|
@ -299,9 +299,9 @@ Cola.Tokenizer.StringInfo = function () {
|
|||
};
|
||||
|
||||
Cola.Tokenizer.with_eof_error = function (eof_error, cont) {
|
||||
return function(x) {
|
||||
return function() {
|
||||
try {
|
||||
return cont.call(this, x);
|
||||
return cont.apply(this, arguments);
|
||||
} catch(ex) {
|
||||
if (ex === Cola.EX_EOF) this.parse_error(eof_error);
|
||||
else throw ex;
|
||||
|
|
@ -454,7 +454,7 @@ Cola.Tokenizer.prototype.hex_bytes = function (n) {
|
|||
return num;
|
||||
};
|
||||
|
||||
Cola.Tokenizer.prototype.read_string = Cola.Tokenizer.with_eof_error("Unterminated string constant", function(raw){
|
||||
Cola.Tokenizer.prototype.read_string = Cola.Tokenizer.with_eof_error("Unterminated string constant", function(raw, noq){
|
||||
var quote = this.next(), ret = "";
|
||||
|
||||
if (!this.is_js && !raw) {
|
||||
|
|
@ -464,7 +464,7 @@ Cola.Tokenizer.prototype.read_string = Cola.Tokenizer.with_eof_error("Unterminat
|
|||
}
|
||||
this.S.string.at[this.S.string.level].inside = true;
|
||||
|
||||
if (quote != '"' && quote != "'" && quote != '`') {
|
||||
if (noq) {
|
||||
ret = quote;
|
||||
quote = this.S.string.at[this.S.string.level].quote;
|
||||
} else
|
||||
|
|
@ -680,7 +680,7 @@ Cola.Tokenizer.prototype.next_token = function (force_regexp) {
|
|||
ch = this.peek();
|
||||
if (ch == '@') return this.read_at();
|
||||
if (ch == '{' && this.peek(1) == '{') return this.read_braces();
|
||||
return this.read_string();
|
||||
return this.read_string(false, true);
|
||||
}
|
||||
|
||||
this.skip_whitespace();
|
||||
|
|
@ -1498,7 +1498,7 @@ Cola.Parser.prototype.vardefs = function (no_in, in_const, type) {
|
|||
};
|
||||
|
||||
Cola.Parser.prototype.var_ = function(no_in, type) {
|
||||
!type && (type = "dynamic");
|
||||
(!type || type == "var") && (type = "dynamic");
|
||||
return new Cola.AST_Var({
|
||||
start : this.prev(),
|
||||
definitions : this.vardefs(no_in, false, type),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"description": "ColaScript translator / parser / mangler / compressor / beautifier toolkit",
|
||||
"homepage": "https://github.com/TrigenSoftware/ColaScript",
|
||||
"main": "tools/node.js",
|
||||
"version": "0.5.8",
|
||||
"version": "0.5.81",
|
||||
"engines": { "node" : ">=0.4.0" },
|
||||
"maintainers": [{
|
||||
"name": "Dan Onoshko (dangreen)",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user