Merge branch 'master' into 2011-09-09-CxScript
Conflicts: contrib/geshi/chaiscript.php include/chaiscript/language/chaiscript_common.hpp include/chaiscript/language/chaiscript_eval.hpp include/chaiscript/language/chaiscript_parser.hpp
This commit is contained in:
@@ -48,7 +48,7 @@ $language_data = array (
|
|||||||
'ESCAPE_CHAR' => '\\',
|
'ESCAPE_CHAR' => '\\',
|
||||||
'KEYWORDS' => array(
|
'KEYWORDS' => array(
|
||||||
1 => array(
|
1 => array(
|
||||||
'break', 'else', 'else if', 'eval', 'for', 'if', 'return', 'while', 'try', 'catch', 'finally', 'switch', 'case', 'default',
|
'break', 'else', 'else if', 'eval', 'for', 'if', 'return', 'while', 'try', 'catch', 'finally', 'case', 'switch', 'default',
|
||||||
),
|
),
|
||||||
2 => array(
|
2 => array(
|
||||||
'def', 'false', 'fun', 'true', 'var', 'auto', 'attr',
|
'def', 'false', 'fun', 'true', 'var', 'auto', 'attr',
|
||||||
|
@@ -870,6 +870,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Inline_Array_AST_Node : public AST_Node {
|
struct Inline_Array_AST_Node : public AST_Node {
|
||||||
public:
|
public:
|
||||||
Inline_Array_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Inline_Array, const std::shared_ptr<std::string> &t_fname=std::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
|
Inline_Array_AST_Node(const std::string &t_ast_node_text = "", int t_id = AST_Node_Type::Inline_Array, const std::shared_ptr<std::string> &t_fname=std::shared_ptr<std::string>(), int t_start_line = 0, int t_start_col = 0, int t_end_line = 0, int t_end_col = 0) :
|
||||||
|
22
unittests/switch_break.chai
Normal file
22
unittests/switch_break.chai
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
var total = 0;
|
||||||
|
|
||||||
|
switch(2) {
|
||||||
|
case (1) {
|
||||||
|
total += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (2) {
|
||||||
|
total += 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (3) {
|
||||||
|
total += 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (4) {
|
||||||
|
total += 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal(total, 2)
|
18
unittests/switch_default.chai
Normal file
18
unittests/switch_default.chai
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
var total = 0;
|
||||||
|
|
||||||
|
switch(2) {
|
||||||
|
case (1) {
|
||||||
|
total += 1;
|
||||||
|
}
|
||||||
|
case (3) {
|
||||||
|
total += 4;
|
||||||
|
}
|
||||||
|
case (4) {
|
||||||
|
total += 8;
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
total += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal(total, 16)
|
4
unittests/switch_empty.chai
Normal file
4
unittests/switch_empty.chai
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
switch(true) { }
|
||||||
|
|
||||||
|
// We just have to get here without error for success
|
||||||
|
assert_equal(true, true);
|
18
unittests/switch_fallthru.chai
Normal file
18
unittests/switch_fallthru.chai
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
var total = 0;
|
||||||
|
|
||||||
|
switch(2) {
|
||||||
|
case (1) {
|
||||||
|
total += 1;
|
||||||
|
}
|
||||||
|
case (2) {
|
||||||
|
total += 2;
|
||||||
|
}
|
||||||
|
case (3) {
|
||||||
|
total += 4;
|
||||||
|
}
|
||||||
|
case (4) {
|
||||||
|
total += 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal(total, 14);
|
19
unittests/switch_fallthru_and_break.chai
Normal file
19
unittests/switch_fallthru_and_break.chai
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
var total = 0;
|
||||||
|
|
||||||
|
switch(2) {
|
||||||
|
case (1) {
|
||||||
|
total += 1;
|
||||||
|
}
|
||||||
|
case (2) {
|
||||||
|
total += 2;
|
||||||
|
}
|
||||||
|
case (3) {
|
||||||
|
total += 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (4) {
|
||||||
|
total += 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal(total, 6)
|
Reference in New Issue
Block a user