~ubuntu-branches/ubuntu/maverick/gcalctool/maverick

« back to all changes in this revision

Viewing changes to src/mp-equation-lexer.l

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-12-22 10:06:16 UTC
  • mfrom: (1.1.63 upstream)
  • Revision ID: james.westby@ubuntu.com-20091222100616-5ir8k6orw75omhdi
Tags: 5.29.4-0ubuntu1
* New upstream release:
  * Make 0^0 = 1
  * Use superscript digits for scientific notation
  * Clear display when entering a number after an equation
  * Make Ctrl+W a shortcut to quit
  * Updated translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
DEC           {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}|{EIGHT}|{NINE}
51
51
HEX           {DEC}|[A-F]
52
52
SUPER_DIGITS  "⁰"|"¹"|"²"|"³"|"⁴"|"⁵"|"⁶"|"⁷"|"⁸"|"⁹"
 
53
SUPER_MINUS   "⁻"
53
54
SUB_DIGITS    "₀"|"₁"|"₂"|"₃"|"₄"|"₅"|"₆"|"₇"|"₈"|"₉"
54
55
FRACTION      "½"|"⅓"|"⅔"|"¼"|"¾"|"⅕"|"⅖"|"⅗"|"⅘"|"⅙"|"⅚"|"⅛"|"⅜"|"⅝"|"⅞"
55
 
INVERSE       "⁻¹"
56
56
GREEKS        "α"|"β"|"γ"|"δ"|"ε"|"ζ"|"η"|"θ"|"ι"|"κ"|"λ"|"μ"|"ν"|"ξ"|"ο"|"π"|"ρ"|"ς"|"σ"|"τ"|"υ"|"φ"|"χ"|"ψ"|"ω"
57
57
LETTERS       [a-zA-Z]|{GREEKS}
58
58
 
59
59
SUP_NUM  {SUPER_DIGITS}+
 
60
NSUP_NUM {SUPER_MINUS}{SUPER_DIGITS}+
60
61
SUB_NUM  {SUB_DIGITS}+
61
62
WORD     {LETTERS}+
62
63
DEC_NUM  {DEC}+|{DEC}*{DECIMAL}{DEC}+
63
64
BASE_NUM {HEX}+{SUB_NUM}|{HEX}*{DECIMAL}{HEX}+{SUB_NUM}
64
65
 
65
66
NUMBER   {DEC_NUM}|{BASE_NUM}|{FRACTION}|{DEC_NUM}{FRACTION}
66
 
VARIABLE {WORD}|{WORD}{SUB_NUM}|{WORD}{INVERSE}|{GREEKS}
 
67
VARIABLE {WORD}|{WORD}{SUB_NUM}|{WORD}"⁻¹"|{GREEKS}
67
68
 
68
69
MOD  [mM][oO][dD]
69
70
AND  "∧"|[aA][nN][dD]
88
89
{XOR}       {return tXOR;}
89
90
{IN}        {return tIN;}
90
91
{NUMBER}    {if (mp_set_from_string(yytext, &yylval->int_t) != 0) REJECT; return tNUMBER;}
91
 
{SUP_NUM}   {yylval->integer = super_atoi(yytext); return tSUPNUM; }
92
 
{SUB_NUM}   {yylval->integer = sub_atoi(yytext); return tSUBNUM; }
 
92
{SUP_NUM}   {yylval->integer = super_atoi(yytext); return tSUPNUM;}
 
93
{NSUP_NUM}  {yylval->integer = super_atoi(yytext); return tNSUPNUM;}
 
94
{SUB_NUM}   {yylval->integer = sub_atoi(yytext); return tSUBNUM;}
93
95
{VARIABLE}  {yylval->name = strdup(yytext); return tVARIABLE;}
94
 
{INVERSE}   {return tINVERSE;}
95
96
[ \t\n]
96
97
.           {return *yytext;}
97
98