Attachment 'openroad.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - OpenRoad Source Parser
4
5 @copyright: 2007 by Anke Heinrich <anke.heinrich@gmail.com>
6 @license: GNU GPL, see COPYING for details.
7 """
8
9 from MoinMoin.util.ParserBase import ParserBase
10
11 Dependencies = []
12
13 class Parser(ParserBase):
14
15 parsername = 'ColorizedOpenRoad'
16 extensions = ['.or']
17 Dependencies = []
18
19 def __init__(self, raw, request, **kw):
20 ParserBase.__init__(self,raw,request,**kw)
21 self._ignore_case = 1
22
23 def setupRules(self):
24 ParserBase.setupRules(self)
25
26 self.addRulePair("Comment","/[*]","[*]/")
27 self.addRule("Comment","//.*$")
28 self.addRulePair("String",'\'','\'')
29 self.addRule("ID","[a-zA-Z_][a-zA-Z0-9_]*![a-zA-Z_][a-zA-Z0-9_]*")
30 self.addRule("ID","[a-zA-Z_][a-zA-Z0-9_]*")
31 self.addRule("ID","CurFrame")
32 self.addRule("ID","CurProcedure")
33 self.addRule("ID","CurMethod")
34 self.addRule("ID","CurObject")
35 self.addRule("Number",r"[0-9](\.[0-9]+)?")
36 self.addRule("Number",r"[xX]\'([0-9a-fA-F][0-9a-fA-F])+\'")
37 self.addRule("SPChar",r"[*()+=\[\];,.<>/-]#\:")
38
39 reserved_words = ['ABORT','ALL','ALTER','AND','ANY','AS','ASC','AT','AVG',
40 'BEGIN','BETWEEN','BY','BYREF','CALL','CALLFRAME',
41 'CALLPROC','CASE','CLEAR','CLOSE','COMMIT','CONNECT',
42 'CONTINUE','COPY','COUNT','CREATE','CURRENT','DBEVENT',
43 'DECLARE','DEFAULT','DELETE','DELETEROW','DESC','DIRECT',
44 'DISCONNECT','DISTINCT','DO','DROP','ELSE','ELSEIF','END',
45 'ENDCASE','ENDDECLARE','ENDFOR','ENDIF','ENDLOOP',
46 'ENDWHILE','ESCAPE','EXECUTE','EXISTS','EXIT','FETCH',
47 'FIELD','FOR','FROM','GOTOFRAME','GRANT','GROUP',
48 'HAVING','IF','IMMEDIATE','IN','INDEX','INITIALISE',
49 'INITIALIZE','INQUIRE_INGRES','INQUIRE_SQL','INSERT',
50 'INSERTROW','INSTALLATION','INTEGRITY','INTO','KEY',
51 'LIKE','LINK','MAX','MESSAGE','METHOD','MIN','MODE',
52 'MODIFY','NEXT','NOECHO','NOT','OF','ON','OPEN',
53 'OPENFRAME','OR','ORDER','PERMIT','PROCEDURE','PROMPT',
54 'QUALIFICATION','RAISE','REGISTER','RELOCATE','REMOVE',
55 'REPEAT','REPEATED','RESUME','RETURN','RETURNING',
56 'REVOKE','ROLE','ROLLBACK','RULE','SAVE','SAVEPOINT',
57 'SELECT','SET','SLEEP','SOME','SUM','SYSTEM','TABLE',
58 'THEN','TO','TRANSACTION','UNION','UNIQUE','UNTIL',
59 'UPDATE','VALUES','VIEW','WHERE','WHILE','WITH','WORK']
60
61 self.addReserved(reserved_words)
62
63 system_events = ['CHILDCLICK','CHILDCLICKPOINT','CHILDCOLLAPSED',
64 'CHILDDETAILS','CHILDDOUBLECLICK','CHILDDRAGBOX',
65 'CHILDDRAGSEGMENT','CHILDENTRY','CHILDEXIT',
66 'CHILDEXPANDED','CHILDHEADERCLICK','CHILDMOVED',
67 'CHILDPROPERTIES','CHILDRESIZED','CHILDSCROLL',
68 'CHILDSELECT','CHILDSELECTIONCHANGED','CHILDSETVALUE',
69 'CHILDUNSELECT','CHILDVALIDATE','CLICK','CLICKPOINT',
70 'COLLAPSED','DBEVENT','DETAILS','DOUBLECLICK','DRAGBOX',
71 'DRAGSEGMENT','ENTRY','EXIT','EXPANDED','EXTCLASSEVENT',
72 'FRAMEACTIVATE','FRAMEDEACTIVATE','HEADERCLICK',
73 'INSERTROW','LABELCHANGED','MOVED','PAGEACTIVATED',
74 'PAGECHANGED','PAGEDEACTIVATED','PROPERTIES','RESIZED',
75 'SCROLL','SELECT','SELECTIONCHANGED','SETVALUE',
76 'TERMINATE','UNSELECT','USEREVENT','VALIDATE',
77 'WINDOWCLOSE','WINDOWICON','WINDOWMOVED','WINDOWRESIZED',
78 'WINDOWVISIBLE']
79
80 self.addReserved(system_events)
81
82 system_functions = ['IFNULL']
83
84 self.addReserved(system_functions)
85
86 types = ['ARRAY','BYTE','CHAR','DATE','DECIMAL','FLOAT','FLOAT4',
87 'FLOAT8','INT1','INT2','INT4','INTEGER','INTEGER1',
88 'INTEGER2','INTEGER4','MONEY','OBJECT_KEY',
89 'SECURITY_LABEL','SMALLINT','TABLE_KEY','VARCHAR']
90
91 self.addReserved(types)
92
93 system_classes = ['ACTIVEFIELD','ANALOGFIELD','APPFLAG','APPSOURCE',
94 'ARRAYOBJECT','ATTRIBUTEOBJECT','BARFIELD',
95 'BITMAPOBJECT','BOXTRIM','BREAKSPEC','BUTTONFIELD',
96 'CELLATTRIBUTE','CHOICEBITMAP','CHOICEDETAIL',
97 'CHOICEFIELD','CHOICEITEM','CHOICELIST','CLASS',
98 'CLASSSOURCE','COLUMNCROSS','COLUMNFIELD',
99 'COMPOSITEFIELD','COMPSOURCE','CONTROLBUTTON',
100 'CROSSTABLE','CURSORBITMAP','CURSOROBJECT','DATASTREAM',
101 'DATEOBJECT','DBEVENTOBJECT','DBSESSIONOBJECT',
102 'DISPLAYFORM','DYNEXPR','ELLIPSESHAPE','ENTRYFIELD',
103 'ENUMFIELD','EVENT','EXTOBJECT',' EXTOBJFIELD',
104 'FIELDOBJECT','FLEXIBLEFORM','FLOATOBJECT','FORMFIELD',
105 'FRAMEEXEC','FRAMEFORM','FRAMESOURCE','FREETRIM',
106 'GHOSTEXEC','GHOSTSOURCE','IMAGEFIELD','IMAGETRIM',
107 'INTEGEROBJECT','LISTFIELD','LISTVIEWCOLATTR',
108 'LISTVIEWFIELD','LONGBYTEOBJECT','LONGVCHAROBJECT',
109 'MATRIXFIELD','MENUBAR','MENUBUTTON','MENUFIELD',
110 'MENUGROUP','MENUITEM','MENULIST','MENUSEPARATOR',
111 'MENUSTACK','MENUTOGGLE','METHODEXEC','METHODOBJECT',
112 'MONEYOBJECT','OBJECT','OPTIONFIELD','OPTIONMENU',
113 'PALETTEFIELD','POPUPBUTTON','PROC4GLSOURCE','PROCEXEC',
114 'PROCHANDLE','QUERYCOL','QUERYOBJECT',' QUERYPARM',
115 'QUERYTABLE','RADIOFIELD','RECTANGLESHAPE','ROWCROSS',
116 'SCALARFIELD','SCOPE','SCROLLBARFIELD','SEGMENTSHAPE',
117 'SESSIONOBJECT','SHAPEFIELD','SLIDERFIELD','SQLSELECT',
118 'STACKFIELD','STRINGOBJECT','SUBFORM','TABBAR',
119 'TABFIELD','TABFOLDER','TABLEFIELD','TABPAGE',
120 'TOGGLEFIELD','TREE','TREENODE','TREEVIEWFIELD',
121 'USERCLASSOBJECT','USEROBJECT','VIEWPORTFIELD']
122
123 self.addReserved(system_classes)
124
125 constant_words = ['TRUE','FALSE','NULL',
126 'BF_BMP','BF_GIF','BF_SUNRASTER','BF_TIFF',
127 'BF_WINDOWCURSOR','BF_WINDOWICON','BF_XBM',
128 'CC_BACKGROUND','CC_BLACK','CC_BLUE','CC_BROWN','CC_CYAN',
129 'CC_DEFAULT_1','CC_DEFAULT_10','CC_DEFAULT_11',
130 'CC_DEFAULT_12','CC_DEFAULT_13','CC_DEFAULT_14',
131 'CC_DEFAULT_15','CC_DEFAULT_16','CC_DEFAULT_17',
132 'CC_DEFAULT_18','CC_DEFAULT_19','CC_DEFAULT_2',
133 'CC_DEFAULT_20','CC_DEFAULT_21','CC_DEFAULT_22',
134 'CC_DEFAULT_23','CC_DEFAULT_24','CC_DEFAULT_25',
135 'CC_DEFAULT_26','CC_DEFAULT_27','CC_DEFAULT_28',
136 'CC_DEFAULT_29','CC_DEFAULT_3','CC_DEFAULT_30',
137 'CC_DEFAULT_4','CC_DEFAULT_5','CC_DEFAULT_6',
138 'CC_DEFAULT_7','CC_DEFAULT_8','CC_DEFAULT_9',
139 'CC_FOREGROUND','CC_GRAY','CC_GREEN','CC_LIGHT_BLUE',
140 'CC_LIGHT_BROWN','CC_LIGHT_CYAN','CC_LIGHT_GRAY',
141 'CC_LIGHT_GREEN','CC_LIGHT_ORANGE','CC_LIGHT_PINK',
142 'CC_LIGHT_PURPLE','CC_LIGHT_RED','CC_LIGHT_YELLOW',
143 'CC_MAGENTA','CC_ORANGE','CC_PALE_BLUE','CC_PALE_BROWN',
144 'CC_PALE_CYAN','CC_PALE_GRAY','CC_PALE_GREEN',
145 'CC_PALE_ORANGE','CC_PALE_PINK','CC_PALE_PURPLE',
146 'CC_PALE_RED','CC_PALE_YELLOW','CC_PINK CC_PURPLE',
147 'CC_RED','CC_SYS_ACTIVEBORDER','CC_SYS_ACTIVECAPTION',
148 'CC_SYS_APPWORKSPACE','CC_SYS_BACKGROUND',
149 'CC_SYS_BTNFACE','CC_SYS_BTNSHADOW','CC_SYS_BTNTEXT',
150 'CC_SYS_CAPTIONTEXT','CC_SYS_GRAYTEXT',
151 'CC_SYS_HIGHLIGHT','CC_SYS_HIGHLIGHTTEXT',
152 'CC_SYS_INACTIVEBORDER','CC_SYS_INACTIVECAPTION',
153 'CC_SYS_INACTIVECAPTIONTEXT','CC_SYS_MENU',
154 'CC_SYS_MENUTEXT','CC_SYS_SCROLLBAR','CC_SYS_SHADOW',
155 'CC_SYS_WINDOW','CC_SYS_WINDOWFRAME',
156 'CC_SYS_WINDOWTEXT','CC_WHITE','CC_YELLOW',
157 'CL_INVALIDVALUE','CP_BOTH','CP_COLUMNS','CP_NONE',
158 'CP_ROWS','CS_CLOSED','CS_CURRENT','CS_NOCURRENT',
159 'CS_NO_MORE_ROWS','CS_OPEN','CS_OPEN_CACHED','DC_BW',
160 'DC_COLOR','DP_AUTOSIZE_FIELD','DP_CLIP_IMAGE',
161 'DP_SCALE_IMAGE_H','DP_SCALE_IMAGE_HW',
162 'DP_SCALE_IMAGE_W','DS_CONNECTED','DS_DISABLED',
163 'DS_DISCONNECTED','DS_INGRES_DBMS','DS_NO_DBMS',
164 'DS_ORACLE_DBMS','DS_SQLSERVER_DBMS','DV_NULL',
165 'DV_STRING','DV_SYSTEM','EH_NEXT_HANDLER','EH_RESUME',
166 'EH_RETRY','EP_INTERACTIVE','EP_NONE','EP_OUTPUT',
167 'ER_FAIL','ER_NAMEEXISTS','ER_OK','ER_OUTOFRANGE',
168 'ER_ROWNOTFOUND','ER_USER1','ER_USER10','ER_USER2',
169 'ER_USER3','ER_USER4','ER_USER5','ER_USER6','ER_USER7',
170 'ER_USER8','ER_USER9','FA_BOTTOMCENTER',
171 'FA_BOTTOMLEFT','FA_BOTTOMRIGHT','FA_CENTER',
172 'FA_CENTERLEFT','FA_CENTERRIGHT','FA_DEFAULT','FA_NONE',
173 'FA_TOPCENTER','FA_TOPLEFT','FA_TOPRIGHT',
174 'FB_CHANGEABLE','FB_CLICKPOINT','FB_DIMMED','FB_DRAGBOX',
175 'FB_DRAGSEGMENT','FB_FLEXIBLE','FB_INVISIBLE',
176 'FB_LANDABLE','FB_MARKABLE','FB_RESIZEABLE',
177 'FB_VIEWABLE','FB_VISIBLE','FC_LOWER','FC_NONE','FC_UPPER',
178 'FM_QUERY','FM_READ','FM_UPDATE','FM_USER1','FM_USER2',
179 'FM_USER3','FO_DEFAULT','FO_HORIZONTAL','FO_VERTICAL',
180 'FP_BITMAP','FP_CLEAR','FP_CROSSHATCH','FP_DARKSHADE',
181 'FP_DEFAULT','FP_HORIZONTAL','FP_LIGHTSHADE','FP_SHADE',
182 'FP_SOLID','FP_VERTICAL','FT_NOTSETVALUE','FT_SETVALUE',
183 'FT_TABTO','FT_TAKEFOCUS','GF_BOTTOM','GF_DEFAULT',
184 'GF_LEFT','GF_RIGHT','GF_TOP','HC_DOUBLEQUOTE',
185 'HC_FORMFEED','HC_NEWLINE','HC_QUOTE','HC_SPACE','HC_TAB',
186 'HV_CONTENTS','HV_CONTEXT','HV_HELPONHELP','HV_KEY',
187 'HV_QUIT','LS_3D','LS_DASH','LS_DASHDOT','LS_DASHDOTDOT',
188 'LS_DEFAULT','LS_DOT','LS_SOLID','LW_DEFAULT',
189 'LW_EXTRATHIN','LW_MAXIMUM','LW_MIDDLE','LW_MINIMUM',
190 'LW_NOLINE','LW_THICK','LW_THIN','LW_VERYTHICK',
191 'LW_VERYTHIN','MB_DISABLED','MB_ENABLED','MB_INVISIBLE',
192 'MB_MOVEABLE','MT_ERROR','MT_INFO','MT_NONE','MT_WARNING',
193 'OP_APPEND','OP_NONE','OS3D','OS_DEFAULT','OS_SHADOW',
194 'OS_SOLID','PU_CANCEL','PU_OK','QS_ACTIVE','QS_INACTIVE',
195 'QS_SETCOL','QY_ARRAY','QY_CACHE','QY_CURSOR','QY_DIRECT',
196 'RC_CHILDSELECTED','RC_DOWN','RC_END','RC_FIELDFREED',
197 'RC_FIELDORPHANED','RC_GROUPSELECT','RC_HOME','RC_LEFT',
198 'RC_MODECHANGED','RC_MOUSECLICK','RC_MOUSEDRAG',
199 'RC_NEXT','RC_NOTAPPLICABLE','RC_PAGEDOWN','RC_PAGEUP',
200 'RC_PARENTSELECTED','RC_PREVIOUS','RC_PROGRAM',
201 'RC_RESUME','RC_RETURN','RC_RIGHT','RC_ROWDELETED',
202 'RC_ROWINSERTED','RC_ROWSALLDELETED','RC_SELECT',
203 'RC_TFSCROLL','RC_TOGGLESELECT','RC_UP','RS_CHANGED',
204 'RS_DELETED','RS_NEW','RS_UNCHANGED','RS_UNDEFINED',
205 'SK_CLOSE','SK_COPY','SK_CUT','SK_DELETE','SK_DETAILS',
206 'SK_DUPLICATE','SK_FIND','SK_GO','SK_HELP','SK_NEXT',
207 'SK_NONE','SK_PASTE','SK_PROPS','SK_QUIT','SK_REDO',
208 'SK_SAVE','SK_TFDELETEALLROWS','SK_TFDELETEROW',
209 'SK_TFFIND','SK_TFINSERTROW','SK_UNDO','SP_APPSTARTING',
210 'SP_ARROW','SP_CROSS','SP_IBEAM','SP_ICON','SP_NO',
211 'SP_SIZE','SP_SIZENESW','SP_SIZENS','SP_SIZENWSE',
212 'SP_SIZEWE','SP_UPARROW','SP_WAIT','SY_NT','SY_OS2',
213 'SY_UNIX','SY_VMS','SY_WIN95','TF_COURIER','TF_HELVETICA',
214 'TF_LUCIDA','TF_MENUDEFAULT','TF_NEWCENTURY','TF_SYSTEM',
215 'TF_TIMESROMAN','UE_DATAERROR','UE_EXITED',
216 'UE_NOTACTIVE','UE_PURGED','UE_RESUMED','UE_UNKNOWN',
217 'WI_MOTIF','WI_MSWIN32','WI_MSWINDOWS','WI_NONE WI_PM',
218 'WP_FLOATING','WP_INTERACTIVE','WP_PARENTCENTERED',
219 'WP_PARENTRELATIVE','WP_SCREENCENTERED',
220 'WP_SCREENRELATIVE','WV_ICON','WV_INVISIBLE',
221 'WV_UNREALIZED','WV_VISIBLE']
222
223 self.addConstant(constant_words)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.