aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_compile
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-01-15 07:42:42 -0700
committerMcCabe Maxsted2009-01-15 07:42:42 -0700
commit2fa0def3e1656802c69d92ab066ef584214b3ce4 (patch)
tree868a0609142a347d9f6a5b379dfc1dc6ae6e1d42 /linden/indra/lscript/lscript_compile
parentUpdated changelog (diff)
downloadmeta-impy-2fa0def3e1656802c69d92ab066ef584214b3ce4.zip
meta-impy-2fa0def3e1656802c69d92ab066ef584214b3ce4.tar.gz
meta-impy-2fa0def3e1656802c69d92ab066ef584214b3ce4.tar.bz2
meta-impy-2fa0def3e1656802c69d92ab066ef584214b3ce4.tar.xz
Added compile support for multiline comments
Diffstat (limited to 'linden/indra/lscript/lscript_compile')
-rw-r--r--linden/indra/lscript/lscript_compile/indra.l27
1 files changed, 24 insertions, 3 deletions
diff --git a/linden/indra/lscript/lscript_compile/indra.l b/linden/indra/lscript/lscript_compile/indra.l
index 3e62195..2616b47 100644
--- a/linden/indra/lscript/lscript_compile/indra.l
+++ b/linden/indra/lscript/lscript_compile/indra.l
@@ -36,7 +36,8 @@ FS (f|F)
36#include "llclickaction.h" 36#include "llclickaction.h"
37 37
38void count(); 38void count();
39void comment(); 39void line_comment();
40void block_comment();
40void parse_string(); 41void parse_string();
41 42
42#define YYLMAX 16384 43#define YYLMAX 16384
@@ -60,7 +61,8 @@ extern "C" { int yyerror(const char *fmt, ...); }
60%} 61%}
61 62
62%% 63%%
63"//" { gInternalLine++; gInternalColumn = 0; comment(); } 64"//" { gInternalLine++; gInternalColumn = 0; line_comment(); }
65"/*" { block_comment(); }
64 66
65"integer" { count(); return(INTEGER); } 67"integer" { count(); return(INTEGER); }
66"float" { count(); return(FLOAT_TYPE); } 68"float" { count(); return(FLOAT_TYPE); }
@@ -790,7 +792,7 @@ S32 yywrap()
790 return(1); 792 return(1);
791} 793}
792 794
793void comment() 795void line_comment()
794{ 796{
795 char c; 797 char c;
796 798
@@ -798,6 +800,25 @@ void comment()
798 ; 800 ;
799} 801}
800 802
803void block_comment()
804{
805 char c1 = 0;
806 char c2 = yyinput();
807 while (c2 != 0 && c2 != EOF && !(c1 == '*' && c2 == '/')) {
808 if (c2 == '\n')
809 {
810 gInternalLine++;
811 gInternalColumn = 0;
812 }
813 else if (c2 == '\t')
814 gInternalColumn += 4 - (gInternalColumn % 8);
815 else
816 gInternalColumn++;
817 c1 = c2;
818 c2 = yyinput();
819 }
820}
821
801void count() 822void count()
802{ 823{
803 S32 i; 824 S32 i;