Menu

#125 Highlighting for GP -- have language file but need some help

closed-fixed
BenBE
5
2012-12-25
2011-05-17
Anonymous
No

I've attached an attempt toward a language file, but there are things I'd like to fix first.

First of all, \ is an escape character only in special cases: \n, \t, \e, and \", I think. Outside of strings it represents integer division. So in " \" " it should be interpreted as an escape (or else the string won't be terminated properly) and in 5\3 it must be interpreted as an operator (or else it will look for the non-existent escape "\3"). It doesn't really matter what happens to strings like " \p " but ideally these would be treated as either escapes or errors.

Second, I would like to limit category 2 and 3 keywords. Category 2 is for defaults, which appear only in the context "default(foo)" or "default(foo, bar)" (with optional spaces). Category 3 is types, which occur only after a colon following a variable. Any idea on how to code these? Oh, and it would be nice if strings containing *exactly* one of the types were highlighted: "t_INT" but not "t_ INT" or "type: t_INT". (The function type() returns a string in GP.)

Also, I'm not sure how GeSHi handles constants, but it's worth mentioning that GP accepts 1. as a t_REAL (floating-point constant) equal to 1.0, and similarly with .1 = 0.1.

Discussion

  • Nobody/Anonymous

    First attempt at a language description file

     
  • BenBE

    BenBE - 2011-07-05

    To make \ escape only in certain instances use the hard escape feature or use escape regexp. For an example have a look at the PHP language file.

    Also could you upload some example code for testing the language file?

     
  • BenBE

    BenBE - 2011-07-05
    • assigned_to: nobody --> benbe
    • milestone: --> Next_Release_(Stable)
    • status: open --> open-accepted
     
  • BenBE

    BenBE - 2011-10-11
    • status: open-accepted --> pending-fixed
     
  • BenBE

    BenBE - 2012-08-18
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.