summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-15 20:24:41 +0200
committerHaru <haru@dotalux.com>2013-11-28 02:35:01 +0100
commit09dd2097b77bf3dda4c5eb1ee6eb2a60f05bbec8 (patch)
tree5864b4bdae94373089b2de7c9b7ec986b033a235 /npc
parent9a802b9147221ec1f31109242be2919f53401fd3 (diff)
downloadhercules-09dd2097b77bf3dda4c5eb1ee6eb2a60f05bbec8.tar.gz
hercules-09dd2097b77bf3dda4c5eb1ee6eb2a60f05bbec8.tar.bz2
hercules-09dd2097b77bf3dda4c5eb1ee6eb2a60f05bbec8.tar.xz
hercules-09dd2097b77bf3dda4c5eb1ee6eb2a60f05bbec8.zip
Added support for automatic concatenation of adjacent string literals
- [ This commit is part of a larger script engine related update ] - Adjacent string literals are now automatically concatenated into one string upon parsing. - Adjacent string literals are string literals (i.e. "such as this", with only whitespace (including line breaks and/or comments) between them. For example, the lines: mes "this will be concatenated " /* skipping this comment */ " into one string"; // at parse time will produce an output of "this will be concatenated into one string". - The feature brings parity with other languages (i.e. C), and makes it easier to split long strings in multiple lines, without having to resort to a, slower, run-time string concatenation operator ('+') - Special thanks to Trojal for the idea. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'npc')
-rw-r--r--npc/custom/test.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/npc/custom/test.txt b/npc/custom/test.txt
index bfd297f5d..0fffecf73 100644
--- a/npc/custom/test.txt
+++ b/npc/custom/test.txt
@@ -19,6 +19,15 @@ OnCheck:
//end;
}
return;
+OnCheckStr:
+ .@msg$ = getarg(0,"Unknown Error");
+ .@val$ = getarg(1,"");
+ .@ref$ = getarg(2,"");
+ if (.@val$ != .@ref$) {
+ debugmes "Error: "+.@msg$+": '"+.@val$+"' != '"+.@ref$+"'";
+ //end;
+ }
+ return;
OnInit:
// Array subscript
setarray .@a, 3, 2, 1;
@@ -226,6 +235,11 @@ OnInit:
callsub(OnCheck, "Order of <,>,==", .@y);
+ .@x$ = "string "
+ "concatenation" /* test */ " succeeded";
+ callsub(OnCheckStr, "String concatenation", .@x$, "string concatenation succeeded");
+
+
// Bitwise & operator
.@x = (7&4); // 0111 & 0100 --> 0100
.@y = (4&1); // 0100 & 0001 --> 0000