bug fix
This commit is contained in:
parent
e5d3cb56c0
commit
e6a49779ae
24
README.md
24
README.md
|
|
@ -46,7 +46,7 @@ Now you can run your Cola-Code:
|
||||||
|
|
||||||
<script type="text/colascript" src="path/to/your.cola"></script>
|
<script type="text/colascript" src="path/to/your.cola"></script>
|
||||||
|
|
||||||
If `your.cola` depends on other scripts in `your.html`,it's better to notice `browser-cola` about it:
|
If `your.cola` depends on other scripts in `your.html`, it's better to notice `browser-cola` about it:
|
||||||
|
|
||||||
<script type="text/colascript" src="angular.min.js"></script>
|
<script type="text/colascript" src="angular.min.js"></script>
|
||||||
<script type="text/colascript" src="path/to/your.cola"></script>
|
<script type="text/colascript" src="path/to/your.cola"></script>
|
||||||
|
|
@ -384,6 +384,18 @@ Future plans
|
||||||
|
|
||||||
- static typing
|
- static typing
|
||||||
- rename runtime prefix `$_cola` to `_crt$$`
|
- 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
|
- dotal names of refs
|
||||||
|
|
||||||
String String::replaceAll(a, b){
|
String String::replaceAll(a, b){
|
||||||
|
|
@ -484,10 +496,6 @@ Future plans
|
||||||
|
|
||||||
- ES6 `for`
|
- ES6 `for`
|
||||||
|
|
||||||
for({String name, String login, String photoUrl} in usesr){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for(name of names){
|
for(name of names){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -506,9 +514,9 @@ Future plans
|
||||||
this; // parent context
|
this; // parent context
|
||||||
});
|
});
|
||||||
|
|
||||||
- namespaces
|
- namespaces, name of namespace must be cupitalized
|
||||||
|
|
||||||
@use namespace Cola {
|
@use Cola {
|
||||||
|
|
||||||
class AST_Node {
|
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
|
- asm.js native syntax, for example
|
||||||
|
|
||||||
// cola
|
// 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_OCT_NUMBER = /^0[0-7]+$/;
|
||||||
Cola.RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
|
Cola.RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
|
||||||
|
|
||||||
Cola.OPERATORS = [
|
Cola.OPERATORS = [ // d - different left and right types of vars, s - same
|
||||||
"in",
|
"in", // binary - d
|
||||||
"instanceof",
|
"instanceof", // binary - d
|
||||||
"typeof",
|
"typeof", // unary - dynamic
|
||||||
"new",
|
"new", // unary
|
||||||
//"void",
|
//"void", // unary
|
||||||
"delete",
|
"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
|
// ColaScript
|
||||||
"clone",
|
"clone",
|
||||||
"isset",
|
"isset",
|
||||||
|
|
@ -299,9 +299,9 @@ Cola.Tokenizer.StringInfo = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Cola.Tokenizer.with_eof_error = function (eof_error, cont) {
|
Cola.Tokenizer.with_eof_error = function (eof_error, cont) {
|
||||||
return function(x) {
|
return function() {
|
||||||
try {
|
try {
|
||||||
return cont.call(this, x);
|
return cont.apply(this, arguments);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
if (ex === Cola.EX_EOF) this.parse_error(eof_error);
|
if (ex === Cola.EX_EOF) this.parse_error(eof_error);
|
||||||
else throw ex;
|
else throw ex;
|
||||||
|
|
@ -454,7 +454,7 @@ Cola.Tokenizer.prototype.hex_bytes = function (n) {
|
||||||
return num;
|
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 = "";
|
var quote = this.next(), ret = "";
|
||||||
|
|
||||||
if (!this.is_js && !raw) {
|
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;
|
this.S.string.at[this.S.string.level].inside = true;
|
||||||
|
|
||||||
if (quote != '"' && quote != "'" && quote != '`') {
|
if (noq) {
|
||||||
ret = quote;
|
ret = quote;
|
||||||
quote = this.S.string.at[this.S.string.level].quote;
|
quote = this.S.string.at[this.S.string.level].quote;
|
||||||
} else
|
} else
|
||||||
|
|
@ -680,7 +680,7 @@ Cola.Tokenizer.prototype.next_token = function (force_regexp) {
|
||||||
ch = this.peek();
|
ch = this.peek();
|
||||||
if (ch == '@') return this.read_at();
|
if (ch == '@') return this.read_at();
|
||||||
if (ch == '{' && this.peek(1) == '{') return this.read_braces();
|
if (ch == '{' && this.peek(1) == '{') return this.read_braces();
|
||||||
return this.read_string();
|
return this.read_string(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.skip_whitespace();
|
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) {
|
Cola.Parser.prototype.var_ = function(no_in, type) {
|
||||||
!type && (type = "dynamic");
|
(!type || type == "var") && (type = "dynamic");
|
||||||
return new Cola.AST_Var({
|
return new Cola.AST_Var({
|
||||||
start : this.prev(),
|
start : this.prev(),
|
||||||
definitions : this.vardefs(no_in, false, type),
|
definitions : this.vardefs(no_in, false, type),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"description": "ColaScript translator / parser / mangler / compressor / beautifier toolkit",
|
"description": "ColaScript translator / parser / mangler / compressor / beautifier toolkit",
|
||||||
"homepage": "https://github.com/TrigenSoftware/ColaScript",
|
"homepage": "https://github.com/TrigenSoftware/ColaScript",
|
||||||
"main": "tools/node.js",
|
"main": "tools/node.js",
|
||||||
"version": "0.5.8",
|
"version": "0.5.81",
|
||||||
"engines": { "node" : ">=0.4.0" },
|
"engines": { "node" : ">=0.4.0" },
|
||||||
"maintainers": [{
|
"maintainers": [{
|
||||||
"name": "Dan Onoshko (dangreen)",
|
"name": "Dan Onoshko (dangreen)",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user