1# *************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20# *************************************************************
21
22Based on the C grammar for arithmetic expressions
23=================================================
24
25number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
26
27number_exponent = 'e'|'E'
28
29basic_number = basic_number number_digit | number_digit
30
31number =
32	   basic_number |
33
34	   basic_number number_exponent basic_number |
35	   basic_number number_exponent '-' basic_number |
36	   basic_number number_exponent '+' basic_number |
37
38	   '.' basic_number number_exponent basic_number |
39	   '.' basic_number number_exponent '-' basic_number |
40	   '.' basic_number number_exponent '+' basic_number |
41
42	   basic_number '.' number_exponent basic_number |
43	   basic_number '.' number_exponent '-' basic_number |
44	   basic_number '.' number_exponent '+' basic_number |
45
46	   basic_number '.' basic_number number_exponent basic_number |
47	   basic_number '.' basic_number number_exponent '-' basic_number |
48	   basic_number '.' basic_number number_exponent '+' basic_number
49
50
51identifier = '$'|'pi'|'e'|'X'|'Y'|'Width'|'Height'
52              ^            ^   ^     ^       ^
53              |            |   |     |       |
54	 '$' in PPT            |   |     |       |
55			 '#ppt_x' in PPT   |     |       |
56			     '#ppt_y' in PPT     |       |
57				       '#ppt_w' in PPT       |
58                               '#ppt_h' in PPT
59
60unary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'|'acos'|'asin'|'exp'|'log'
61binary_function = 'min'|'max'
62
63
64basic_expression =
65				 number |
66				 identifier |
67				 unary_function '(' additive_expression ')' |
68				 binary_function '(' additive_expression ',' additive_expression ')' |
69				 '(' additive_expression ')'
70
71unary_expression = '-' basic_expression
72
73multiplicative_expression =
74						  basic_expression |
75						  multiplicative_expression '*' basic_expression |
76						  multiplicative_expression '/' basic_expression
77
78additive_expression =
79					multiplicative_expression |
80					additive_expression '+' multiplicative_expression |
81					additive_expression '-' multiplicative_expression
82
83