User Tag List

Results 1 to 9 of 9

Thread: ZC 2.future Codebase Changes (Log)

  1. #1
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%

    ZC [2.future] Codebase Changes (Log)

    Logging some codebase changes here. These apply mostly to 2.xx, but they may also be used in the present (ZScript-enabled) builds of ZC3.x.

    script_drawing.cpp

    Added routines to do_drawbitmapr() that allow using Allegro sprites for effects:

    The present 'rotation' argument is now used for the following: Enable transparency, rotation.

    Works as follows:

    • if rot is 0, it draws opaque, but does not rotate.
    • if rot is between -360 and 360, it draws opaque, and rotates normally.
    • if rot is either between 361 and 720, or between -361 and -720 it rotates, but is transparent
    • if rot is outside these limits, it draws a transparent bitmap with no rotation.



    Did initial work on do_drawquadr() to allow mapping a bitmap as a texture, in addition to tiles/combos.
    Works as follows: A value above MAX_TILES (65519) will use a bitmap as a texture. At present, how this is to work is undefined, however I plan to use the normal RT_* in addition to a constant TEX_BITMAP = 65520 to point to the bitmap in question.
    Xor mode drawing, with extremely limited support, using OP_XOR to all drawing prims. This works with bitmaps perfectly well, but not with direct screen drawing. I do not have a personal desire to muck with the colour table to fix it, but perhaps Dimentio does. Either way, with the changes to do_drawbitmapr(), it should be feasible to use Xor drawing reliably.

    I plan to further expand do_drawbitmapr(), but I need to determine what other sprite effects to use. Until i test the latest modifications, I'll hold off on any further changes.


    Initial work on Polygon() / POLYGON*, but not Polygon3d() / POLYGON3D*
    These need ZASM side instructions in the bytecode, and other things, to be enabled. I believe that I know how to do this, but at present this is not a certainty.
    I initially did this before the release of 2.50.2, but Saffith did not want to add a new function, so it'll go into 2.

    Parser/Lexer:

    Initial modifications to allow some global symbols.

    Char ? will be added to symbols for IDENTIFIER, to allow var, and function names such as ?Walking()
    Char ? also needs to be added to lexical errors if it is a single char, to prevent accidental use where char / is desired.
    Char ^^ added as symbol LOGICALXOR
    The LOGICALXOR component is not implemented, but I added it to the .lpp file as a valid symbol (placeholder)
    Symbol COMMENTBLOCK using /* and */, but again, not implemented.
    Token #include added. I intend to add the token type DIRECTIVE and various strings as directive types. I may simply add # as the token for DIRECTIVE, and any legal INDENTIFIER chars as the string.

    At present #include is set to function as import "" and is only partially implemented.

    ...

  2. #2
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,817
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,940
    Level
    33
    vBActivity - Bars
    Lv. Percent
    24.2%
    Really, there should be an extra parameter for translucency. Like my pappy used to say: "forwards compatibility of yesterday today, nonsensical and confusing rubbish of yesterday tomorrow".

    Not that the all drawing stuff are the greatest or anything, but still.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  3. #3
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Quote Originally Posted by Gleeok View Post
    Really, there should be an extra parameter for translucency. Like my pappy used to say: "forwards compatibility of yesterday today, nonsensical and confusing rubbish of yesterday tomorrow".

    Not that the all drawing stuff are the greatest or anything, but still.
    I know, and I agree; but only to a point. I'd rather do the extra things using overloads, so that older scripts don't break. This is primarily because you can't expect users to know how to update a script, particularly if the author doesn't update it (and you know that they won't); and also, because sometimes changing arguments will result in quests breaking., such as Starshooter, if you recall, I had to fix a few calls to make it work on any 2.5 final release.

    I'll probably add overloads in, eventually, but for the moment, this works, to test things, and of course, we're still waiting on you, too, before we do anything officially for 2.future, so there's that.

    http://timelord.insomnia247.nl/zc/sc...3D_Bitmaps.cpp

    Added support to Quad(), Quad3D(), Triangle(), and Triangle3D() to use a bitmap RT_* as a valid texture. I'm not entirely certain that what I did is correct, so if it isn't, then feel free to throw pet rocks.

    This change uses the texture argument, and functions by using a value of 65520 as RT_0, 65521 as RT_1, and so forth. Thus, in ZScript (and std.zh) this would be represented as:

    Code:
     
    const int TEX_BITMAP = 65520; 
    
    void Quad3D(layer, pos, uv, cset, size, size, TEX_BITMAP+RT_BITMAP3, mode );
    I don't think that it is possible to read the screen as a bitmap, via: zscriptDrawingRenderTarget->GetBitmapPtr(-1) ; -- or is it?
    That could make for some rather interesting effects, if it's legal.

    I set the minimum value for this method as '0', so if it's possible to read the screen as a bitmap like that, I'll need to adjust the values a tiny bit, to permit it.

    If you have a moment, please look at how I set up the drawing commands, and tell me if I did anything that is obviously broken. I think one point that I may need to address, is the size (w and h) used in the vertices vectors. I set it up to do the vectors, create the bitmaps, and then issue the draw instruction inside the statements that read the type (tile, combo, bitmap) of texture. This feels like unnecessary duplication, but at least I know what I'm looking at, this way.

  4. #4
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,817
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,940
    Level
    33
    vBActivity - Bars
    Lv. Percent
    24.2%
    In general, reading the backbuffer at any arbitrary point in time during a frame is just a really bad idea; you'd have to look at what allegro4 does with it for every platform, which I just assume is not possible (someone correct me if I am wrong). If you look at what 'Wavy' does you'll see why it does it there. (Also, scanlines, etc.) Maybe you'd have to just request it, ex;

    Code:
    Screen->RequestBackbuffer(RT_BITMAP0, sx, sy, sw, sh, dx, dy, dw, dh); //will be available after a call to Waitframe(); ...or WaitDraw() ..?

    I know, and I agree; but only to a point. I'd rather do the extra things using overloads, so that older scripts don't break. This is primarily because you can't expect users to know how to update a script, particularly if the author doesn't update it (and you know that they won't); and also, because sometimes changing arguments will result in quests breaking., such as Starshooter, if you recall, I had to fix a few calls to make it work on any 2.5 final release.
    It won't affect older scripts if it's a different function. 2.5x was supposed to be only bugfixes anyway. I think it's pretty bug free at this point. Might as well just start from 2.60; then you only have to worry about backward compatibility with 2.50, but can add in proper features and not ones shoehorned in.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  5. #5
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Quote Originally Posted by Gleeok View Post
    In general, reading the backbuffer at any arbitrary point in time during a frame is just a really bad idea; you'd have to look at what allegro4 does with it for every platform, which I just assume is not possible (someone correct me if I am wrong). If you look at what 'Wavy' does you'll see why it does it there. (Also, scanlines, etc.) Maybe you'd have to just request it, ex;

    Code:
    Screen->RequestBackbuffer(RT_BITMAP0, sx, sy, sw, sh, dx, dy, dw, dh); //will be available after a call to Waitframe(); ...or WaitDraw() ..?
    I will indeed examine how Screen->(Effect) works at present, to see how it's read. I think it'd be available after a Waitdraw() call though, as bitmap rendering occurs then, and is copies to the visible screen at Waitframe().

    Else, I'm wrong, which would be for the Nth time this week, as it is every week.

    It won't affect older scripts if it's a different function. 2.5x was supposed to be only bugfixes anyway. I think it's pretty bug free at this point. Might as well just start from 2.60; then you only have to worry about backward compatibility with 2.50, but can add in proper features and not ones shoehorned in.
    What I figured to do, was finish a few things that were intended for 2.5, add in a few things that people whine about (including things that I routinely wish were present), maybe implement (an easy/basic) VC mechanism, and leave anything that demanded big sweeping changes, like increasing the number of available pointers for all these objects, for 2.60+.

    Unlike some, I try to use SW versioning that makes sense, so I wouldn't want to jump from 2.50 to 2.60. If ZC used small numbering, 2.5.1, instead of 2.50.1, it would make sense to jump tot 2.6; but 2.60 represents a drastic change (to me), whereas 2.51, 2.52, etc make sense for minor changes. Sadly, we do have to skip those numbers, to prevent user confusion as people have been labelling 2.50.1 et. al as 2.51 and 2.51 and so forth.

    That's why I'd go with 2.53, 2.54, or 2.55. The last of these 'sounds' better, but is inaccurate, unless we include more than a few small things. It would still make sense as an incremental release, considering that some of the things on that list are going to be monumentally convoluted. I don't even know if the changes listed on shardstorm ( build > 1793 ) represent a base for 2.50.3, or something else. We're actually going to need to discuss how everyone wants to handle that, as well as how build numbering is set up, as I know that you and Saffith have a system for that, but it's a mystery to everyone.

    The main thing, is that internal, and external build IDs differ, and that's something I'd like to consolidate, so that devs, and users, are on the same page. At the very least, ZC needs to report the build to ZScript in some fashion. I think that is better than reporting the version number, as the build is unique, and the version number may not be unique.

    Did you review either of those files, that I sent across? I'm mainly concerned about the vectors in the drawing functions, and of course, I'm still uncertain what the best way to handle Polygon() will be. ideally, reading/duplicating the structure of a ZScript array directly into a local array, or vector, on the engine side, and declaring the size based on the size of the ZC array, would be best. It may also be convoluted, but that's another matter. I think that some of the ideas that I had for Polygon(), I already sent over, but IDR.

    I might add DrawSprite() as a function though, in addition to DrawBitmap() rather than having a dozen variations of DrawBitmap(), to call the Allegro 4 sprite functions. Insofar as additions go, I think that would be best, but I wonder if it would confuse users, given that sprites are also an internal ZQuest thing of their own.

  6. #6
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Parser, proposed changes/additions (r12 - 23rd February, 2016). This file should be a drop-in replacement for ffscript.lpp, and all the additions (that are complete) should work properly. All the incomplete additions should either be disabled, or be redirected to do something that is already possible.

    I'm uncertain how I want to format declaration tokens for array, char, and string; for new types, as these (if used as TOKENS) would conflict with pre-existing IDENTIFIERS. The ideal solutions would be to add a second layer to the parser, to view tokens in CONTEXT; but that is a daunting task.

    The temporary solution is that declarations of new types would use the directive format, such as #array, or all caps ( e.g. ARRAY ). Either, or both of these would prevent possible conflicts.

    Also, while it is plausible that there exists a script where someone defined constants for some of these tokens, such as TRUE or ELSE, that is simply terrible programming, and if those break, then the scriptmaker can easily correct this, as the likelihood of many scripts doing something that bizarre is minimal, and it is rather unlikely that they will be in general use by non-scripters.

    For this reason, all the normal tokens will be available both in lowercase, and in ALLCAPS: This permits following some other (common) C-styles, for those who care about such things.

    Note that anything in the comment blocks is simply proposed. There is no promise of these things coming to fruition, or indeed, of them being desirable. Some of them, such as SETFLAG* are included in the file, as a model to do some ZASM things directly in ZScript. This is somewhat dangerous, as people may use them improperly, but at least it affords doing some things in ZScriopt that are otherwise only possible with ZASM.

    Of course, I'm uncertain that we would ever do a true GOTO instruction for ZScript, but you never know. It would be useful to do hardwired overrides, and that's about all; as it's easy to wreck a script with improper GOTOs, and then again, if we did GOTOs, they'd reference ZASM instruction numbers, not ZScript line numbers.

    More interesting are things like CASE, and DEFINE, if we manage to fit those into the lexicon.

    The following code is the drop-in file, should anyone wish to test it:

    Spoiler: show
    Code:
    /*
     use this file to generate lex.yy.c
    command: flex -B -olex.yy.cpp ffscript.lpp
    
    Rev 2016-v14 : 23FEB2016
    */
    
    %option yylineno
    %option noyywrap
    %option never-interactive
    WS	[ \t\n\r]
    
    %{
    #include <stdlib.h>
    #include "AST.h"
    #include "../zsyssimple.h"
    #include "y.tab.hpp"
    YYLTYPE noloc = {0,0,0,0};
    void doLines();
    %}
    
    %%
    
    script                    { doLines();return SCRIPT; }
    float				  { doLines(); return FLOAT; }
    int					  { doLines(); return FLOAT; }
    
    for				  { doLines(); return FOR; }
    bool				  { doLines();return BOOL; }
    void				  { doLines();return VOID; }
    if				  { doLines();return IF; }
    else				  { doLines();return ELSE; }
    return			  { doLines();return RETURN; }
    import			  { doLines();return IMPORT; }
    true				  { doLines();return TRUE; }
    false				  { doLines();return FALSE; }
    while				{doLines(); return WHILE;}
    ffc					{doLines(); return FFC;}
    itemdata			{doLines(); return ITEMCLASS;}
    item				{doLines(); return ITEM;}
    global				{doLines(); return GLOBAL;}
    break				{doLines(); return BREAK;}
    continue			{doLines(); return CONTINUE;}
    const				{doLines(); return CONST;}
    do					{doLines(); return DO;}
    npc					{doLines(); return NPC;}
    lweapon					{doLines(); return LWEAPON;}
    eweapon					{doLines(); return EWEAPON;}
    
    
    
    \-\>		{ doLines(); return ARROW;}
    \<\<=		{ doLines(); return LSHIFTASSIGN; }
    \>\>=		{ doLines(); return RSHIFTASSIGN; }
    \<\<		{ doLines(); return LSHIFT; }
    \>\>		{ doLines(); return RSHIFT; }
    \<=			{ doLines();return LE; }
    \<			{ doLines();return LT; }
    \>=			{ doLines();return GE; }
    \>			{ doLines();return GT; }
    ==			{ doLines();return EQ; }
    \!=			{ doLines();return NE; }
    \=			{ doLines();return ASSIGN; }
    \+=			{ doLines();return PLUSASSIGN; }
    \-=			{ doLines();return MINUSASSIGN; }
    \*=			{ doLines();return TIMESASSIGN; }
    \/=			{ doLines();return DIVIDEASSIGN; }
    \&\&=		{ doLines();return ANDASSIGN; }
    \|\|=		{ doLines();return ORASSIGN; }
    \&=			{ doLines();return BITANDASSIGN; }
    \|=			{ doLines();return BITORASSIGN; }
    \^=			{ doLines();return BITXORASSIGN; }
    \%=			{ doLines();return MODULOASSIGN; }
    \;			{ doLines();return SEMICOLON; }
    \,			{ doLines();return COMMA; }
    \[			{ doLines();return LBRACKET; }
    \]			{ doLines();return RBRACKET; }
    \(			{ doLines();return LPAREN; }
    \)			{ doLines();return RPAREN; }
    \+\+		{ doLines();return INCREMENT; }
    \-\-		{ doLines();return DECREMENT; }
    \.          { doLines();return DOT; }
    \+			{ doLines();return PLUS; }
    \-                { doLines();return MINUS; }
    \*			{ doLines();return TIMES; }
    \/\/.*            { ; }
    \/                { doLines();return DIVIDE; }
    \{                { doLines();return LBRACE; }
    \}                { doLines();return RBRACE; }
    \&\&			{ doLines();return AND; }
    \|\|			{ doLines();return OR; }
    
    \&				{ doLines(); return BITAND; }
    \|				{ doLines(); return BITOR; }
    \~				{ doLines(); return BITNOT; }
    \^				{ doLines(); return BITXOR; }
    \!			{ doLines();return NOT; }
    \%			{ doLines(); return MODULO; }
    
    /* Additions by ZoriaRPG
    
    These do not have a peroper case statement at present, or any handlers.
    
    npcdata { doLines(); return NPCDATA; }
    NPCDATA { doLines(); return NPCDATA; }
    
    setflag         { doLines();return SETFLAG; }
    setflagfalse    { doLines();return SETFLAGFALSE; }
    setflagtrue     { doLines();return SETFLAGTRUE; }
    setflagmore     { doLines();return SETFLAGMORE; }
    setflagless     { doLines();return SETFLAGLESS; }
    goto            { doLines();return GOTO; }
    gototrue        { doLines();return GOTOTRUE; }
    gotofalse       { doLines();return GOTOFALSE; }
    gotoless        { doLines();return GOTOLESS; }
    gotomore        { doLines();return GOTOMORE; }
    
    arraytoindex    { doLines();return ARRAYTOINDEX; } //Store array in an index of another array..
    
    POINTER         { doLines();return POINTER; }
    
    SETFLAG         { doLines();return SETFLAG; }
    SETFLAGFALSE    { doLines();return SETFLAGFALSE; }
    SETFLAGTRUE     { doLines();return SETFLAGTRUE; }
    SETFLAGMORE     { doLines();return SETFLAGMORE; }
    SETFLAGLESS     { doLines();return SETFLAGLESS; }
    GOTO            { doLines();return GOTO; }
    GOTOTRUE        { doLines();return GOTOTRUE; }
    GOTOFALSE       { doLines();return GOTOFALSE; }
    GOTOLESS        { doLines();return GOTOLESS; }
    GOTOMORE        { doLines();return GOTOMORE; }
    
    ARRAYTOINDEX    { doLines();return ARRAYTOINDEX; } //Store array in an index of another array..
    
    POINTER         { doLines();return POINTER; }
    
    until           { doLines(); return UNTIL; }
    UNTIL           { doLines(); return UNTIL; }
    
    \#\d\e\f\i\n\e { doLines();return DEFINE; } //We need an actual include directive.
    \#\c\a\s\e{ doLines();return CASE; } //We need an actual include directive.
    case { doLines();return CASE; }
    CASE { doLines();return CASE; }
    /// char { doLines();return CHAR; }
    \#\c\h\a\r { doLines();return CHAR; }
    CHAR { doLines();return CHAR; }
    /// array { doLines();return NEWARRAY; } //This could be a problem if the parser reads something like '
    int array[]', picking uo the identifier 'array' as a token. :(
    \#\a\r\r\a\y { doLines();return NEWARRAY; } 
    ARRAY { doLines();return NEWARRAY; } 
    /// string { doLines();return NEWSTRING; } //For the same reason...
    \#\s\t\r\i\n\g { doLines();return NEWSTRING; }
    STRING { doLines();return NEWSTRING; }
    
    
    // 'int'type Integer that is automatically floored
    igr                     {doLines(); return INTEGER; }
    IGR                     {doLines(); return INTEGER; }
    
    //New types for numerical values
    \u\n\s\i\g\n\e\d\ \l\o\n\g   {doLines(); return UNSINGLEDLONG; } 
    \u\n\s\i\g\n\e\d\ \i\n\t   {doLines(); return UNSINGLEDINT; } 
    \u\n\s\i\g\n\e\d\ \f\l\o\a\t   {doLines(); return UNSINGLEDFLOAT; } 
    \u\n\s\i\g\n\e\d\ \i\g\r   {doLines(); return UNSINGLEDIGR; } 
    
    \s\i\g\n\e\d\ \i\g\r  {doLines(); return SINGLEDIGR; } 
    
    \s\i\g\n\e\d\ \l\o\n\g   {doLines(); return SINGLEDLONG; } 
    \s\i\g\n\e\d\ \i\n\t   {doLines(); return SINGLEDINT; } 
    s\i\g\n\e\d\ \f\l\o\a\t   {doLines(); return SINGLEDFLOAT; } 
    
    
    
    \^\^			{ doLines();return LOGICALXOR; }
    // If we can add XOR, with a custom function, this would be nice. 
    
    ([*][_a-zA-Z])  {        doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return USERPOINTER; 
    					}
                        
    \?      { doLines(); return QMARK; }
    
    
    
    */
    
    SCRIPT                    { doLines();return SCRIPT; }
    FLOAT				  { doLines(); return FLOAT; }
    INT					  { doLines(); return FLOAT; }
    
    FOR				  { doLines(); return FOR; }
    BOOL				  { doLines();return BOOL; }
    VOID				  { doLines();return VOID; }
    IF				  { doLines();return IF; }
    ELSE				  { doLines();return ELSE; }
    RETURN			  { doLines();return RETURN; }
    IMPORT			  { doLines();return IMPORT; }
    \#\i\m\p\o\r\t			  { doLines();return IMPORT; }
    \#\I\M\P\O\R\T			  { doLines();return IMPORT; }
    TRUE				  { doLines();return TRUE; }
    FALSE				  { doLines();return FALSE; }
    WHILE				{doLines(); return WHILE;}
    FFC					{doLines(); return FFC;}
    ITEMDATA			{doLines(); return ITEMCLASS;}
    ITEM				{doLines(); return ITEM;}
    GLOBAL				{doLines(); return GLOBAL;}
    BREAK				{doLines(); return BREAK;}
    CONTINUE			{doLines(); return CONTINUE;}
    CONST				{doLines(); return CONST;}
    DO					{doLines(); return DO;}
    NPC					{doLines(); return NPC;}
    LWEAPON					{doLines(); return LWEAPON;}
    EWEAPON					{doLines(); return EWEAPON;}
    
    
    
    \#\i\n\c\l\u\d\e { doLines();return IMPORT; } //We need an actual include directive.
    
    
    //Add comment blocks. We need a comment block function, for the parser. 
    //Begin vomment block.
    \/\*.*             { ; } //We need to have a special { doLines(); return COMMENTBLOCK } routine here.
    //End comment block.
    \*\/             { ; } //We need to have a special { doLines(); return COMMENTBLOCK } routine here.
    
    \:\:		{ doLines(); return ARROW;} /*  This is for AngelScript compat. Note that if we
                                                add scope resolution, we will need to change this
                                                to reflect that addition. otherwise, we can use this
                                                as a pointer dereferencing token. */
                                                
    \:\-\   { doLines(); return ARROW;} 
    
    ([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*{
    						doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return IDENTIFIER; 
    					}
            
    //Add * to the identifier class, but only if at the end of an identifier, and no other alpha
    //or numeric chars follow it. This should prevent it being mistaken for a MULTIPLY token.
    
    ([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*[*^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])]
    {
    						doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return IDENTIFIER; 
    					}
    
    /*
    [^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*][*]([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*
    {                       doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return USERPOINTER; 
    					}
    */
    
    ([0-9]*\.?[0-9]+) 		{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_DECIMAL, yylloc); return NUMBER; }
    
    (0x[0-9a-fA-F]+)		{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_HEX, yylloc); return NUMBER; }
    
    ([0-1]+b)				{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_BINARY, yylloc); return NUMBER; }
    
    (o[0-7])                { doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_OCTAL, yylloc); return NUMBER; } 
                            //We should add TYPE_OCTAL here, (and thus we need to define the return)
    
    
    \"[^\"]+\"				{ doLines();yylval = new ASTString(yytext, yylloc); return QUOTEDSTRING; }
    \"\"                    { doLines();yylval = new ASTString(yytext, yylloc); return QUOTEDSTRING; }
    
    //Is there a reason that an empty QUOTEDSTRING was not allowed?
    
    \'[^\']?\'				{ doLines();yylval = new ASTString(yytext, yylloc); return SINGLECHAR; }
    
    [\x80-\xFF]             { ; }//ASCII chars above 127 register as Whitespace.
    
    {WS}					{ ; } //Whitespace
    
    
    .		{
    	char temp[512];
    	sprintf(temp, "Scanner, line %d: lexical error '%s'.\n", yylineno, yytext); 
    	box_out(temp);
    	box_eol();
    	}
    %%
    void resetLexer(){
    YY_FLUSH_BUFFER;
    yylineno=1;
    }
    void doLines()
    {
    YYLTYPE rval = {yylineno, 0, yylineno, 0};
    yylloc = rval;
    }


    19-Feb Added some types, and symbols, plus clean-up.
    19-Feb Added template routine for octal numbers to parser. Might even work.
    22-Feb Added comment for igr type fo that we don;t forget what it is.
    22-Feb Added unsigned and signed int, long, float defs to ffscript.lpp
    * Unsigned int and float would work as normal ZScript int and float, but from 0 to 429,496.7295
    * Signed|Unsigned long would be a true long. If we do this, then a true float is probably prudent.
    * At present, the parser is set up to read both keywords together as a single token, rather than signedor unsigned being tokens in and of themselves. This is simply easier to handle with the typechecker, if it works.
    * The additional types, such as array, char, unsigned | signed long, are something we want to add to make future AngelScript output easier.

  7. #7
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    Updated, above. Additional updates follow:


    23-Feb : Added :: as equivalent to ->
    23-Feb : Removed * from IDENTIFIERS: This would pose a lexical problem with certain code styles, where use of multiplication does not use spaces on either side of the MULTIPLY token *.
    * Added @ and $ to IDENTIFIERS.
    * Solving this would require scoped, recursive checking that I am not prepared to add to the parser (at this time).

    23-Feb : I added the following line to the flex .lpp file:

    Code:
    [\x80-\xFF]             { ; }//ASCII chars above 127 register as Whitespace.
    If I understand flex formatting, this should convert any char from 0x80 to 0xFF, that is, upper-ASCII that is not part of a QUOTEDSTRING into a whiltespace. This should bypass errors involving these chars. I can add an action to report the error as well, but that'd be a courtesy warning.

    If anyone knows if this is incorrect flex formatting for the set, or can confirm if it's correct, please let me know. (I'm not sure if you can make sets using ASCII values like that, or if you need to list each char individually.)

    23-Feb : Added "" as a token for QUOTEDSTRING. I do not know if this will work, and allow an empty QUOTEDSTRING, or not. The parser may fault because it can't find anything between the quotes. if so, I'll revert this change.

    23-Feb : I re-added the * to the parser, as follows:

    Code:
    //Add * to the identifier class, but only if at the end of an identifier, and no other alpha
    //or numeric chars follow it. This should prevent it being mistaken for a MULTIPLY token.
    
    ([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*[*^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])]
    {
    						doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return IDENTIFIER; 
    					}
    
    /*
    [^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*][*]([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*
    {                       doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return USERPOINTER; 
    					}
    */
    I'm not sure if the logic of these sets if correct, but the idea is that any IDENTIFIER followed by a * and by nothing else, is an IDENTIFIER, and any token that starts with a * and has nothing preceding it, is a pointer. This could however, still cause problems with multiplication if the style is strange, such as:

    Code:
    int val = abc123* 3;
    int val2 = abc123 *3;
    int val3 = abc123 * 3;
    I think we can live with this, to allow * in function/identifier names such as A*(), and in pointers, such as *ptr.

    Otherwise, I can change it to ** as being allowed, but * not allowed.

    I think that I will need to enter the ASCII value for a *, instead of [*], as flex will see that as '0 or more', even in braces. The same may apply for ?.

  8. #8
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%
    23-Feb : Added more types, and some potential plans...

    In this, I also added pure-char tokens for : and, or, not, AND, OR, NOT, inaddition to the symbolic versions; and some prelims for XOR, xor, NAND, nand. NOR, and nor.

    Apparently AngelScript uses this format, so ZScript may as well support it. All of these should work, unless they conflict with identifiers. They shouldn't, if their own internal case statements precede the IDENTIFIER case statement.

    Likewise, I added prelims for case, CASE, switch, and SWITCH.

    This may be easy to add, or a true pain, but I won't know until I do the logic for it.

    Code to follow...damned post-length limitations.

  9. #9
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,760
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.72%

    ffscript.lpp (r16 - 23rd February, 2016)


    Spoiler: show
    Code:
    /*
     use this file to generate lex.yy.c
    command: flex -B -olex.yy.cpp ffscript.lpp
    
    Rev 2016-v16 : 23FEB2016
    */
    
    %option yylineno
    %option noyywrap
    %option never-interactive
    WS	[ \t\n\r]
    
    %{
    #include <stdlib.h>
    #include "AST.h"
    #include "../zsyssimple.h"
    #include "y.tab.hpp"
    YYLTYPE noloc = {0,0,0,0};
    void doLines();
    %}
    
    %%
    
    script                    { doLines();return SCRIPT; }
    float				  { doLines(); return FLOAT; }
    int					  { doLines(); return FLOAT; }
    
    for				  { doLines(); return FOR; }
    bool				  { doLines();return BOOL; }
    void				  { doLines();return VOID; }
    if				  { doLines();return IF; }
    else				  { doLines();return ELSE; }
    return			  { doLines();return RETURN; }
    import			  { doLines();return IMPORT; }
    true				  { doLines();return TRUE; }
    false				  { doLines();return FALSE; }
    while				{doLines(); return WHILE;}
    ffc					{doLines(); return FFC;}
    itemdata			{doLines(); return ITEMCLASS;}
    item				{doLines(); return ITEM;}
    global				{doLines(); return GLOBAL;}
    break				{doLines(); return BREAK;}
    continue			{doLines(); return CONTINUE;}
    const				{doLines(); return CONST;}
    do					{doLines(); return DO;}
    npc					{doLines(); return NPC;}
    lweapon					{doLines(); return LWEAPON;}
    eweapon					{doLines(); return EWEAPON;}
    
    
    
    \-\>		{ doLines(); return ARROW;}
    \<\<=		{ doLines(); return LSHIFTASSIGN; }
    \>\>=		{ doLines(); return RSHIFTASSIGN; }
    \<\<		{ doLines(); return LSHIFT; }
    \>\>		{ doLines(); return RSHIFT; }
    \<=			{ doLines();return LE; }
    \<			{ doLines();return LT; }
    \>=			{ doLines();return GE; }
    \>			{ doLines();return GT; }
    ==			{ doLines();return EQ; }
    \!=			{ doLines();return NE; }
    \=			{ doLines();return ASSIGN; }
    \+=			{ doLines();return PLUSASSIGN; }
    \-=			{ doLines();return MINUSASSIGN; }
    \*=			{ doLines();return TIMESASSIGN; }
    \/=			{ doLines();return DIVIDEASSIGN; }
    \&\&=		{ doLines();return ANDASSIGN; }
    \|\|=		{ doLines();return ORASSIGN; }
    \&=			{ doLines();return BITANDASSIGN; }
    \|=			{ doLines();return BITORASSIGN; }
    \^=			{ doLines();return BITXORASSIGN; }
    \%=			{ doLines();return MODULOASSIGN; }
    \;			{ doLines();return SEMICOLON; }
    \,			{ doLines();return COMMA; }
    \[			{ doLines();return LBRACKET; }
    \]			{ doLines();return RBRACKET; }
    \(			{ doLines();return LPAREN; }
    \)			{ doLines();return RPAREN; }
    \+\+		{ doLines();return INCREMENT; }
    \-\-		{ doLines();return DECREMENT; }
    \.          { doLines();return DOT; }
    \+			{ doLines();return PLUS; }
    \-                { doLines();return MINUS; }
    \*			{ doLines();return TIMES; }
    \/\/.*            { ; }
    \/                { doLines();return DIVIDE; }
    \{                { doLines();return LBRACE; }
    \}                { doLines();return RBRACE; }
    \&\&			{ doLines();return AND; }
    \|\|			{ doLines();return OR; }
    
    \&				{ doLines(); return BITAND; }
    \|				{ doLines(); return BITOR; }
    \~				{ doLines(); return BITNOT; }
    \^				{ doLines(); return BITXOR; }
    \!			{ doLines();return NOT; }
    \%			{ doLines(); return MODULO; }
    
    /* Additions by ZoriaRPG
    
    Note: New definitions need to be added to lex.yy.cpp
    The comments with line number refs in that file that ref lines in this
    file are now incorrect!
    We likely need to expand YY_NUM_RULES 79 to whatever number we eventually have as well.
    This is on line 293 of lex.yy.cpp
    
    THe real 'fun' is modifying: static yyconst short int yy_acclist[276]
    yy_accept[174] =[174]
    etc.
    These hold yy_current_state and other values, I think, as redirects?
    I need to read more of the flex manual.
    */
    
    These do not have a peroper case statement at present, or any handlers.
    
    npcdata { doLines(); return NPCDATA; }
    NPCDATA { doLines(); return NPCDATA; }
    
    setflag         { doLines();return SETFLAG; }
    setflagfalse    { doLines();return SETFLAGFALSE; }
    setflagtrue     { doLines();return SETFLAGTRUE; }
    setflagmore     { doLines();return SETFLAGMORE; }
    setflagless     { doLines();return SETFLAGLESS; }
    goto            { doLines();return GOTO; }
    gototrue        { doLines();return GOTOTRUE; }
    gotofalse       { doLines();return GOTOFALSE; }
    gotoless        { doLines();return GOTOLESS; }
    gotomore        { doLines();return GOTOMORE; }
    
    arraytoindex    { doLines();return ARRAYTOINDEX; } //Store array in an index of another array..
    
    POINTER         { doLines();return POINTER; }
    
    SETFLAG         { doLines();return SETFLAG; }
    SETFLAGFALSE    { doLines();return SETFLAGFALSE; }
    SETFLAGTRUE     { doLines();return SETFLAGTRUE; }
    SETFLAGMORE     { doLines();return SETFLAGMORE; }
    SETFLAGLESS     { doLines();return SETFLAGLESS; }
    GOTO            { doLines();return GOTO; }
    GOTOTRUE        { doLines();return GOTOTRUE; }
    GOTOFALSE       { doLines();return GOTOFALSE; }
    GOTOLESS        { doLines();return GOTOLESS; }
    GOTOMORE        { doLines();return GOTOMORE; }
    
    ARRAYTOINDEX    { doLines();return ARRAYTOINDEX; } //Store array in an index of another array..
    
    POINTER         { doLines();return POINTER; }
    
    until           { doLines(); return UNTIL; }
    UNTIL           { doLines(); return UNTIL; }
    
    switch          { doLines(); return SWITCH; }
    SWITCH          { doLines(); return SWITCH; }
    
    \#\d\e\f\i\n\e { doLines();return DEFINE; } //We need an actual include directive.
    \#\c\a\s\e{ doLines();return CASE; } //We need an actual include directive.
    case { doLines();return CASE; }
    CASE { doLines();return CASE; }
    /// char { doLines();return CHAR; }
    \#\c\h\a\r { doLines();return CHAR; }
    CHAR { doLines();return CHAR; }
    /// array { doLines();return NEWARRAY; } //This could be a problem if the parser reads something like '
    int array[]', picking uo the identifier 'array' as a token. :(
    \#\a\r\r\a\y { doLines();return NEWARRAY; } 
    ARRAY { doLines();return NEWARRAY; } 
    /// string { doLines();return NEWSTRING; } //For the same reason...
    \#\s\t\r\i\n\g { doLines();return NEWSTRING; }
    STRING { doLines();return NEWSTRING; }
    
    obj                     {doLines(); return OBJECT;}
    object                     {doLines(); return OBJECT;}
    OBJ                     {doLines(); return OBJECT;}
    OBJECT                     {doLines(); return OBJECT;}
    
    // 'int'type Integer that is automatically floored
    igr                     {doLines(); return INTEGER; }
    IGR                     {doLines(); return INTEGER; }
    
    //Signed integer types
    int8                    {doLines(); return SIGNEDINTEGER8BIT; }
    INT8                    {doLines(); return SIGNEDINTEGER8BIT; }
    int16                   {doLines(); return SIGNEDINTEGER16BIT; }
    INT16                   {doLines(); return SIGNEDINTEGER16BIT; }
    int32                   {doLines(); return SIGNEDINTEGER32BIT; }
    INT32                   {doLines(); return SIGNEDINTEGER32BIT; }
    
    //Do we want to support 64b values? I don't even believe that we *can* do that.
    INT64                   {doLines(); return SIGNEDINTEGER64BIT; }
    int64                   {doLines(); return SIGNEDINTEGER64BIT; }
    
    uint8                   {doLines(); return UNSIGNEDINTEGER8BIT; }
    UINT8                   {doLines(); return UNSIGNEDINTEGER8BIT; }
    uint16                  {doLines(); return UNSIGNEDINTEGER16BIT; }
    UINT16                  {doLines(); return UNSIGNEDINTEGER16BIT; }
    uint32                  {doLines(); return UNSIGNEDINTEGER32BIT; }
    UINT32                  {doLines(); return UNSIGNEDINTEGER32BIT; }
    
    //Do we want to support 64b values? I don't even believe that we *can* do that.
    uint64                  {doLines(); return UNSIGNEDINTEGER64BIT; }
    UINT64                  {doLines(); return UNSIGNEDINTEGER64BIT; }
    
    //Floating point values.
    float32                 {doLines(); return SIGNEDFLOAT32BIT; }
    FLOAT32                 {doLines(); return SIGNEDFLOAT32BIT; }
    
    //Fix and Fixed
    
    "signed fix"            {doLines(); return SIGNEDINTEGER32BIT; }
    "SIGNED FIX"            {doLines(); return SIGNEDINTEGER32BIT; }
    signed FIX              {doLines(); return SIGNEDINTEGER32BIT; }
    SIGNED fix              {doLines(); return SIGNEDINTEGER32BIT; }
    fix                     {doLines(); return SIGNEDINTEGER32BIT; }
    
    "unsigned fix"            {doLines(); return UNSIGNEDINTEGER32BIT; }
    "UNSIGNED FIX"            {doLines(); return UNSIGNEDINTEGER32BIT; }
    "unsigned FIX"              {doLines(); return UNSIGNEDINTEGER32BIT; }
    "UNSIGNED fix"              {doLines(); return UNSIGNEDINTEGER32BIT; }
    ufix                     {doLines(); return UNSIGNEDINTEGER32BIT; }
    
    "signed fixed"            {doLines(); return SIGNEDINTEGER32BIT; }
    "SIGNED FIXED"            {doLines(); return SIGNEDINTEGER32BIT; }
    "signed FIXED"              {doLines(); return SIGNEDINTEGER32BIT; }
    SIGNED fixed              {doLines(); return SIGNEDINTEGER32BIT; }
    fixed                     {doLines(); return SIGNEDINTEGER32BIT; }
    
    "unsigned fixed"            {doLines(); return UNSIGNEDINTEGER32BIT; }
    "UNSIGNED FIXED"            {doLines(); return UNSIGNEDINTEGER32BIT; }
    "unsigned FIXED"              {doLines(); return UNSIGNEDINTEGER32BIT; }
    "UNSIGNED fixed"              {doLines(); return UNSIGNEDINTEGER32BIT; }
    ufixed                     {doLines(); return UNSIGNEDINTEGER32BIT; }
    
    //Double
    
    double                  {doLines(); return SIGNEDDOUBLE; }
    DOUBLE                  {doLines(); return SIGNEDDOUBLE; }
    udouble                  {doLines(); return UNSIGNEDDOUBLE; }
    DDOUBLE                  {doLines(); return UNSIGNEDDOUBLE; }
    
    //More object tokens
    private             {doLines(); return PRIVATE; }
    PRIVATE             {doLines(); return PRIVATE; }
    get                 {doLines(); return GET; }
    GET                 {doLines(); return GET; }
    
    //New types for numerical values
    \u\n\s\i\g\n\e\d\ \l\o\n\g   {doLines(); return UNSINGLEDLONG; } 
    \u\n\s\i\g\n\e\d\ \i\n\t   {doLines(); return UNSINGLEDINT; } 
    \u\n\s\i\g\n\e\d\ \f\l\o\a\t   {doLines(); return UNSINGLEDFLOAT; } 
    \u\n\s\i\g\n\e\d\ \i\g\r   {doLines(); return UNSINGLEDIGR; } 
    
    \s\i\g\n\e\d\ \i\g\r  {doLines(); return SINGLEDIGR; } 
    
    \s\i\g\n\e\d\ \l\o\n\g   {doLines(); return SINGLEDLONG; } 
    \s\i\g\n\e\d\ \i\n\t   {doLines(); return SINGLEDINT; } 
    s\i\g\n\e\d\ \f\l\o\a\t   {doLines(); return SINGLEDFLOAT; } 
    
    
    
    \^\^			{ doLines();return LOGICALXOR; }
    XOR			{ doLines();return LOGICALXOR; }
    xor			{ doLines();return LOGICALXOR; }
    // If we can add XOR, with a custom function, this would be nice. 
    
    //Other logical operators
    NOR			{ doLines();return LOGICALNOR; }
    nor			{ doLines();return LOGICALNOR; }
    
    NAND			{ doLines();return LOGICALNAND; }
    nand			{ doLines();return LOGICALNAND; }
    
    //Check if two things are identical. This is not the same as ==, but
    determines if two pointers are the same object, etc.
    //This is usedul for conversionto AngelScript for handles.
    IS			{ doLines();return ISTHESAME; }
    is			{ doLines();return ISTHESAME; }
    
    ([*][_a-zA-Z])  {        doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return USERPOINTER; 
    					}
                        
    \?      { doLines(); return QMARK; }
    
    
    
    */
    
    SCRIPT                    { doLines();return SCRIPT; }
    FLOAT				  { doLines(); return FLOAT; }
    INT					  { doLines(); return FLOAT; }
    
    FOR				  { doLines(); return FOR; }
    BOOL				  { doLines();return BOOL; }
    VOID				  { doLines();return VOID; }
    IF				  { doLines();return IF; }
    ELSE				  { doLines();return ELSE; }
    RETURN			  { doLines();return RETURN; }
    IMPORT			  { doLines();return IMPORT; }
    \#\i\m\p\o\r\t			  { doLines();return IMPORT; }
    \#\I\M\P\O\R\T			  { doLines();return IMPORT; }
    TRUE				  { doLines();return TRUE; }
    FALSE				  { doLines();return FALSE; }
    WHILE				{doLines(); return WHILE;}
    FFC					{doLines(); return FFC;}
    ITEMDATA			{doLines(); return ITEMCLASS;}
    ITEM				{doLines(); return ITEM;}
    GLOBAL				{doLines(); return GLOBAL;}
    BREAK				{doLines(); return BREAK;}
    CONTINUE			{doLines(); return CONTINUE;}
    CONST				{doLines(); return CONST;}
    DO					{doLines(); return DO;}
    NPC					{doLines(); return NPC;}
    LWEAPON					{doLines(); return LWEAPON;}
    EWEAPON					{doLines(); return EWEAPON;}
    
    and			{ doLines();return AND; }
    or			{ doLines();return OR; }
    not			{ doLines();return NOT; }
    AND			{ doLines();return AND; }
    OR			{ doLines();return OR; }
    NOT			{ doLines();return NOT; }
    
    
    
    \#\i\n\c\l\u\d\e { doLines();return IMPORT; } //We need an actual include directive.
    
    
    //Add comment blocks. We need a comment block function, for the parser. 
    //Begin vomment block.
    \/\*.*             { ; } //We need to have a special { doLines(); return COMMENTBLOCK } routine here.
    //End comment block.
    \*\/             { ; } //We need to have a special { doLines(); return COMMENTBLOCK } routine here.
    
    \:\:		{ doLines(); return ARROW;} 
    
    /*
    \:\:		{ doLines(); return RESSCOPE;}  This is for AngelScript compat. Note that if we
                                                add scope resolution, we will need to change this
                                                to reflect that addition. otherwise, we can use this
                                                as a pointer dereferencing token. */
                                                
    \:\-\   { doLines(); return ARROW;} 
    
    ([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*{
    						doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return IDENTIFIER; 
    					}
            
    //Add * to the identifier class, but only if at the end of an identifier, and no other alpha
    //or numeric chars follow it. This should prevent it being mistaken for a MULTIPLY token.
    
    ([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*[*^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])]
    {
    						doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return IDENTIFIER; 
    					}
    
    /*
    [^([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*][*]([?]|[_a-zA-Z]|[0-9]|[@][$]+)([?]|[_a-zA-Z]|[0-9]|[@]|[$])*
    {                       doLines();
    						yylval = new ASTString(yytext, yylloc);
    						return USERPOINTER; 
    					}
    */
    
    ([0-9]*\.?[0-9]+) 		{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_DECIMAL, yylloc); return NUMBER; }
    
    (0x[0-9a-fA-F]+)		{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_HEX, yylloc); return NUMBER; }
    
    ([0-1]+b)				{ doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_BINARY, yylloc); return NUMBER; }
    
    (o[0-7])                { doLines();yylval = new ASTFloat(yytext, ASTFloat::TYPE_OCTAL, yylloc); return NUMBER; } 
                            //We should add TYPE_OCTAL here, (and thus we need to define the return)
    
    
    \"[^\"]+\"				{ doLines();yylval = new ASTString(yytext, yylloc); return QUOTEDSTRING; }
    \"\"                    { doLines();yylval = new ASTString(yytext, yylloc); return QUOTEDSTRING; }
    
    //Is there a reason that an empty QUOTEDSTRING was not allowed?
    
    \'[^\']?\'				{ doLines();yylval = new ASTString(yytext, yylloc); return SINGLECHAR; }
    
    [\x80-\xFF]             { ; }//ASCII chars above 127 register as Whitespace.
    
    {WS}					{ ; } //Whitespace
    
    
    .		{
    	char temp[512];
    	sprintf(temp, "Scanner, line %d: lexical error '%s'.\n", yylineno, yytext); 
    	box_out(temp);
    	box_eol();
    	}
    %%
    void resetLexer(){
    YY_FLUSH_BUFFER;
    yylineno=1;
    }
    void doLines()
    {
    YYLTYPE rval = {yylineno, 0, yylineno, 0};
    yylloc = rval;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social