// // Grammatica semplificata di Cognos QDesign // Scritta da Alessandro Polverini // polverini@nibbles.it // Package it.nibbles.p2j.compiler; Helpers a = 'A'|'a'; b = 'B'|'b'; c = 'C'|'c'; d = 'D'|'d'; e = 'E'|'e'; f = 'F'|'f'; g = 'G'|'g'; h = 'H'|'h'; i = 'I'|'i'; j = 'J'|'j'; k = 'K'|'k'; l = 'L'|'l'; m = 'M'|'m'; n = 'N'|'n'; o = 'O'|'o'; p = 'P'|'p'; q = 'Q'|'q'; r = 'R'|'r'; s = 'S'|'s'; t = 'T'|'t'; u = 'U'|'u'; v = 'V'|'v'; w = 'W'|'w'; x = 'X'|'x'; y = 'Y'|'y'; z = 'Z'|'z'; allchars = [0 .. 0xffff]; tab = 9; cr = 13; lf = 10; noneolchar = [allchars -[cr + lf]]; blanks = [' ' + tab]+; h_eol = cr lf | cr | lf; comment = ';' noneolchar*; digit = ['0' .. '9']; nonzerodigit = ['1' .. '9']; lowercase = ['a' .. 'z']; uppercase = ['A' .. 'Z']; nondigit = '_' | lowercase | uppercase ; nondigit_with_dash = nondigit | '-' ; s_char1 = [noneolchar - '"']; s_char2 = [noneolchar - ''']; States normal, file, field, proc ; Tokens b = b ; c = c ; e = e ; f = f ; s = s ; plus = '+'; minus = '-'; div = '/'; mod = '%'; exp = '^'; colon = ':'; product = '*'; comma = ','; comma_on = ',' (blanks | (('&' | ';') noneolchar* h_eol))* o n ; comma_noton = ',' (blanks | (('&' | ';') noneolchar* h_eol))* n o t o n ; hash = '#'; l_par = '('; r_par = ')'; l_square_bracket = '['; r_square_bracket = ']'; {normal, field, file} gt = '>' |'GT'; {normal, field, file} ge = '>' blanks? '=' |'GE'; {normal, field, file} lt = '<' |'LT'; {normal, field, file} le = '<' blanks? '=' |'LE'; {normal, field, file} ne = '<' blanks? '>' |'NE'; {normal, field, file} eq = 'EQ'; // Variabili usate dalle espressioni accessok = a c c e s s o k ; newrecord = n e w r e c o r d ; deletedrecord = d e l e t e d r e c o r d ; alteredrecord = a l t e r e d r e c o r d ; changemode = c h a n g e m o d e ; correctmode = c o r r e c t m o d e ; entrymode = e n t r y m o d e ; findmode = f i n d m o d e ; selectmode = s e l e c t m o d e ; exists = e x i s t s ; occurrence = o c c u r r e n c e ; promptok = p r o m p t o k ; promptok_for = p r o m p t o k blanks f o r ; // Elenco funzioni absolute = a b s o l u t e | a b s ; ascii = a s c i i | a s c ; ceiling = c e i l i n g ; center = c e n t e r | c e n t r e ; f_characters = c h a r a c t e r s ; dateextract = d a t e e x t r a c t ; date = d a t e ; days = d a y s ; decrypt = d e c r y p t; deletesystemval = d e l e t e s y s t e m v a l; downshift = d o w n s h i f t; encrypt = e n c r y p t ; first = f i r s t ; floor = f l o o r ; getsystemval = g e t s y s t e m v a l ; index = i n d e x ; lastday = l a s t d a y ; lj = l j ; lower = l o w e r ; matchpattern = m a t c h p a t t e r n; nconvert = n c o n v e r t | n c o n v | n c o n ; oldvalue = o l d v a l u e ; random = r a n d o m ; rj = r j ; round = r o u n d ; setsystemval = s e t s y s t e m v a l ; size = s i z e ; substring = s u b s t r i n g ; sum = s u m ; truncate = t r u n c a t e | t r u n c ; upper = u p p e r ; upshift = u p s h i f t ; validpattern = v a l i d p a t t e r n ; zerofill = z e r o f i l l | z e r o f i l ; // Altre keywords accept = a c c e p t ; access = a c c e s s ; action = a c t i o n ; activities = a c t i v i t i e s | a c t ; alias = a l i a s ; align = a l i g n ; all = a l l ; allowed = a l l o w e d ; and = a n d ; append = a p p e n d ; ascending = a s c e n d i n g ; audible = a u d i b l e ; auto = a u t o ; backout = b a c k o u t ; backwards = b a c k w a r d s ; background = b a c k g r o u n d ; balance = b a l a n c e ; begin = b e g i n ; black = b l a c k ; blinking = b l i n k i n g ; block = b l o c k ; blue = b l u e ; break = b r e a k ; build = b u i l d ; bwz = b w z ; bytes = b y t e s ; cache = c a c h e ; calling = c a l l i n g ; cancel = c a n c e l ; caption = c a p t i o n ; centered = c e n t e r e d | c e n t r e d ; change = c h a n g e ; character = c h a r a c t e r | c h a r ; close = c l o s e ; cluster = c l u s t e r ; command = c o m m a n d ; commit = c o m m i t ; compile = c o m p i l e ; constant = c o n s t a n t ; constraints = c o n s t r a i n t s ; continue = c o n t i n u e ; costant = c o s t a n t ; count = c o u n t ; cursor = c u r s o r ; cyan = c y a n ; database = d a t a b a s e ; deferred = d e f e r r e d ; define = d e f i n e ; deleted = d e l e t e d ; descending = d e s c e n d i n g ; description = d e s c r i p t i o n ; designer = d e s i g n e r ; detail = d e t a i l ; dictionary = d i c t i o n a r y ; disable = d i s a b l e ; display = d i s p l a y ; displayed = d i s p l a y e d ; displaying = d i s p l a y i n g ; double = d o u b l e ; draw = d r a w ; dual = d u a l ; duplicate = d u p l i c a t e ; dynamiclist = d y n a m i c l i s t ; each = e a c h ; edit = e d i t ; else = e l s e ; entry = e n t r y ; equals = '='; error = e r r o r ; errors = e r r o r s ; excluded = e x c l u d e d ; exclusive = e x c l u s i v e ; exit = e x i t ; external = e x t e r n a l ; files = f i l e s ; fill = f i l l ; final = f i n a l ; find = f i n d ; fixed = f i x e d ; float = f l o a t ; focus = f o c u s ; for = f o r ; force = f o r c e ; form = f o r m ; format = f o r m a t ; from = f r o m ; full = f u l l ; generate = g e n e r a t e ; generic = g e n e r i c ; get = g e t ; green = g r e e n ; group = g r o u p ; halftone = h a l f t o n e ; help = h e l p ; hidden = h i d d e n ; hilite = h i l i t e ; if = i f ; include = i n c l u d e ; included = i n c l u d e d ; information = i n f o r m a t i o n | i n f o ; inherited = i n h e r i t e d ; initial = i n i t i a l ; initialize = i n i t i a l i z e ; input = i n p u t ; integer = i n t e g e r | i n t ; internal = i n t e r n a l ; into = i n t o ; inverse = i n v e r s e ; item = i t e m ; keep = k e e p ; key = k e y ; label = l a b e l ; layout = l a y o u t ; leading = l e a d i n g | l e a d ; let = l e t ; library = l i b r a r y ; linedrawing = l i n e d r a w i n g ; line = l i n e s | l i n e ; list = l i s t ; local = l o c a l ; lock = l o c k ; lookup = l o o k u p ; magenta = m a g e n t a ; mark = m a r k ; master = m a s t e r ; memolog = m e m o l o g ; menu = m e n u ; menuitem = m e n u i t e m ; menumark = m e n u m a r k ; message = m e s s a g e | m e s s ; missing = m i s s i n g ; mode = m o d e ; model = m o d e l ; modify = m o d i f y ; myview = m y v i e w ; need = n e e d ; negative = n e g a t i v e ; nesting = n e s t i n g ; new = n e w ; next = n e x t ; noaction = n o a c t i o n ; noallow = n o a l l o w ; noappend = n o a p p e n d ; noautonext = n o a u t o n e x t ; nobwz = n o b w z ; nochange = n o c h a n g e ; nocommit = n o c o m m i t ; nocorrect = n o c o r r e c t ; nodata = n o d a t a ; nodelete = n o d e l e t e ; nodetail = n o d e t a i l ; noecho = n o e c h o ; noentry = n o e n t r y ; noforce = n o f o r c e ; noform = n o f o r m ; nogeneric = n o g e n e r i c ; noid = n o i d ; noitems = n o i t e m s | n o i t e m ; nolabel = n o l a b e l ; nolist = n o l i s t ; nomark = n o m a r k ; nomenukey = n o m e n u k e y ; nomenukeys = n o m e n u k e y s ; nomode = n o m o d e ; nonullseparator = n o n u l l s e p a r a t o r ; noprint = n o p r i n t ; noselect = n o s e l e c t ; noshift = n o s h i f t ; not = n o t ; notdeleted = n o t d e l e t e d ; noton = n o t o n ; nouse = n o u s e ; noverify = n o v e r i f y ; now = n o w ; nowait = n o w a i t ; nowarn = n o w a r n ; nowarnings = n o w a r n i n g s ; nowraparound = n o w r a p a r o u n d ; null = n u l l ; nullseparator = n u l l s e p a r a t o r ; occurs = o c c u r s ; off = o f f ; on = o n ; only = o n l y ; open = o p e n ; optimistic = o p t i m i s t i c ; optional = o p t i o n a l | o p t ; orderby = o r d e r b y ; ordered = o r d e r e d ; output = o u t p u t ; packed = p a c k e d ; panel = p a n e l ; passing = p a s s i n g ; path = p a t h ; pattern = p a t t e r n ; perform = p e r f o r m ; picture = p i c t u r e | p i c t | p i c ; popup = p o p u p ; positive = p o s i t i v e ; postcommands = p o s t c o m m a n d s ; postfind = p o s t f i n d ; postpath = p o s t p a t h ; postscroll = p o s t s c r o l l ; postupdate = p o s t u p d a t e ; precommands = p r e c o m m a n d ; predisplay = p r e d i s p l a y ; preentry = p r e e n t r y ; prescroll = p r e s c r o l l ; preupdate = p r e u p d a t e ; primary = p r i m a r y ; print = p r i n t ; procedures = p r o c e d u r e s ; process = p r o c e s s ; prompt = p r o m p t ; protected = p r o t e c t e d ; push = p u s h ; put = p u t ; qshow = q s h o w ; query = q u e r y ; quit = q u i t ; read = r e a d ; receiving = r e c e i v i n g ; record = r e c o r d ; recoverable = r e c o v e r a b l e ; red = r e d ; reference = r e f e r e n c e ; refresh = r e f r e s h ; request = r e q u e s t ; required = r e q u i r e d ; reset = r e s e t ; response = r e s p o n s e | r e s ; retrieving = r e t r i e v i n g ; return = r e t u r n ; returning = r e t u r n i n g ; reverse = r e v e r s e ; revise = r e v i s e ; rollback = r o l l b a c k ; run = r u n ; same = s a m e ; save = s a v e ; scale = s c a l e ; screen = s c r e e n ; secondary = s e c o n d a r y ; select = s e l e c t | s e l e ; selectbox = s e l e c t b o x ; separator = s e p a r a t o r ; sequenced = s e q u e n c e d ; sequential = s e q u e n t i a l ; set = s e t ; severe = s e v e r e ; share = s h a r e ; shared = s h a r e d ; show = s h o w ; sign = s i g n ; signed = s i g n e d ; significance = s i g n i f i c a n c e | s i g n i f i c | s i g n i f ; silent = s i l e n t ; skip = s k i p ; slave = s l a v e ; start = s t a r t ; startup = s t a r t u p ; stay = s t a y ; stoplog = s t o p l o g ; stopscreen = s t o p s c r e e n ; subscreen = s u b s c r e e n ; summary = s u m m a r y ; target = t a r g e t ; temporary = t e m p o r a r y | t e m p ; terminate = t e r m i n a t e ; then = t h e n ; thick = t h i c k ; thin = t h i n ; thread = t h r e a d ; times = t i m e s ; title = t i t l e ; trailing = t r a i l i n g ; transaction = t r a n s a c t i o n ; transfer = t r a n s f e r ; underline = u n d e r l i n e ; unique = u n i q u e ; unlock = u n l o c k ; unsigned = u n s i g n e d ; update = u p d a t e ; use = u s e ; users = u s e r s ; using = u s i n g ; values = v a l u e s | v a l u e ; varchar = v a r c h a r ; vertical = v e r t i c a l ; via = v i a ; viaindex = v i a i n d e x ; wait = w a i t ; warning = w a r n i n g | w a r n; warnings = w a r n i n g s ; when = w h e n ; while = w h i l e ; white = w h i t e ; width = w i d t h ; window = w i n d o w ; with = w i t h ; wraparound = w r a p a r o u n d ; write = w r i t e ; yellow = y e l l o w ; zoned = z o n e d ; detail_find = d e t a i l blanks f i n d ; detail_postfind = d e t a i l blanks p o s t f i n d ; detail_delete =d e t a i l blanks d e l e t e ; {normal -> field} field = f i e l d ; {normal -> file} file = f i l e ; {normal -> proc} procedure = p r o c e d u r e | p r o c ; {normal -> proc} do = d o ; {normal, field, file} at = a t ; {normal} go = g o ; {normal} verify = v e r i f y | v e r ; {normal, field, file} f_mod = m o d ; {normal, field, file} id = i d ; {normal, field, file} in = i n ; {normal, field, file} end = e n d ; {normal, field, file} or = o r; of = o f ; {normal, field, file} to = t o ; {normal, field, file} numeric = n u m e r i c | n u m ; {normal, field, file} delete = d e l e t e ; {normal, field, file} clear = c l e a r ; {normal, field, file} default = d e f a u l t ; {file} level = l e v e l ; {field} data = d a t a ; ignorable = comment | blanks | ('&' noneolchar* h_eol (blanks? comment? h_eol)* ); {normal, file -> normal, field -> normal, proc -> normal} newline = h_eol (comment | blanks | h_eol)*; one_string = '"' s_char1* '"' | ''' s_char2* '''; dec_num = digit* '.' digit+ ; number = digit+ ; ident = nondigit (digit | nondigit_with_dash)*; // number = ('0' | nonzerodigit+ | nonzerodigit digit+)? ('.' digit+)?; // TODO: Creare un altro token per i decimali Ignored Tokens ignorable; Productions program = T.newline? everything*; everything = {statement} statement | {verb} verb ; statement = statements T.newline ; verb = {one} verbs T.newline | {block} begin_end T.newline | {if} P.if ; verb_without_if = {one} verbs T.newline | {block} begin_end T.newline ; statements = {access} T.access access_options* | {align} T.align align_group* | {build} T.build build_options* | {cluster} T.cluster cluster_opt* | {define} T.define ident temp_type? when_positive? define_assign? | {description} T.description T.of? desc_type string_list | {draw} T.draw draw_type? draw_par | {field} T.field variable field_opts* | {file} T.file ident in_ident? file_options* | {hilite} T.hilite hilite_object hilite_opt* | {item} T.item variable item_options* | {procedure} T.procedure P.procedure_opt | {screen} T.screen ident screen_options* | {select} T.select T.if? condition | {set} T.set set_options* | {skip} T.skip skip_options? | {subscreen} T.subscreen ident subscreen_options* | {title} T.title string title_par* | {temporary} T.temporary ident temp_type? temp_options* | {transaction} T.transaction T.query T.inherited? trans_opt* ; verbs = {accept} T.accept variable | {block_transfer} T.block T.transfer T.sequenced? T.newline begin_end | {break} T.break | {close} T.close ident | {commit} T.commit T.transaction? ident? | {delete} T.delete ident | {display} T.display variable | {do_internal} T.do internal? ident | {do_external} T.do external ident l_par ident_list r_par | {edit} T.edit variable | {for} T.for T.missing? for_opt* expression T.newline begin_end | {get} T.get ident get_options* | {let} T.let let_var assignment | {lock} T.lock ident lock_opt? lock_type? | {null} T.null | {perform} T.perform T.append | {prompt} T.prompt ident in_ident? T.required? | {push} T.push push_par | {put} T.put put_modifier? ident put_opt_at? reset? | {request} T.request variable | {rollback} T.rollback T.update | {refresh} P.refresh | {return} T.return | {run_command} T.run T.command run_command_name run_command_opts* | {run_screen} T.run T.screen? T.item? ident run_screen_opts* | {run_thread} T.run T.thread T.item? ident T.mode run_screen_mode | {unlock} T.unlock ident | {while} T.while condition T.newline begin_end | {while_retrieving} P.while_retrieving | {messages} messages T.message? T.equals? expression info_opts? ; // TODO: Vedere se è possibile inserire le espressioni di tipo stringa messages = {error} T.error | {severe} T.severe | {warning} T.warning | {information} T.information ; if = T.if condition [i1]:T.newline T.then [i2]:T.newline* verb_without_if opt_else? ; opt_else = T.else T.newline* verb ; in_ident = T.in ident ; begin_end = T.begin T.newline verb* T.end ; info_opts = T.now T.response? ; let_var = {var} P.variable P.substring? | {path} T.path ; push_par = {proc} proc_name | {return} T.return | {update_stay} T.update T.stay | {designer} T.designer P.designer_name ; title_par = {at} T.at [row]:number? T.comma [column]:T.number | {centered} T.centered ; draw_par = {one} [n1]:number T.comma [n2]:number | {normal} T.from? [r1]:number [c1]:draw_col? T.to? [r2]:number [c2]:draw_col? | {columns} T.from? [i1]:T.comma [c1]:T.number T.to? [i2]:T.comma [c2]:T.number ; draw_col = T.comma T.number ; lock_opt = {file} T.file | {record} T.record ; trans_opt = {nocommit} nocommit | {commiton} commit on update | {read} read | {write} write ; lock_type = {exclusive} exclusive | {protected} protected | {shared} shared ; skip_options = {n} number | {to_line} T.to T.line? number | {to_group} T.to T.group? ident ; build_options = {list} list | {detail} detail ; set_options = {nesting} T.nesting number | {verify} T.verify | {noverify} T.noverify | {default} T.default | {delete} T.delete | {summary} T.summary ; put_modifier = {delete} deleted | {new} new | {notdeleted} notdeleted ; put_opt_at = at ident ; for_opt = {each} each | {displayed} displayed | {item} item | {file} file ; draw_type = {thin} T.thin | {thick} T.thick | {double} T.double ; cluster_opt = {at} T.at [l]:number? T.comma [c]:number | {block} T.block T.each? T.all? | {for} T.for [l]:number T.comma [r]:number | {occurs} T.occurs number | {vertical} T.vertical | {occurs_with} T.occurs T.with variable ; align_group = T.l_par number? align_part2? T.r_par ; align_part2 = T.comma number? align_part3? ; align_part3 = T.comma number? ; procedure_opt = {designer} T.designer designer_name designer_opt* T.newline proc_body | {internal} T.internal? proc_name T.newline proc_body | {field} proc_field_name variable T.newline proc_body ; proc_body = {block} begin_end | {null} T.null | {disabled} T.disable ; proc_field_name = {input} T.input | {output} T.output | {process} T.process | {edit} T.edit ; designer_name = {num} T.number | {help} T.help | {of} T.of | {ident} ident ; designer_opt = {precommands} T.precommands proc_name T.stay? | {nodata} T.nodata | {help} T.help string ; proc_name = {append} T.append | {backout} T.backout | {delete} T.delete | {det_delete} T.detail_delete | {det_find} T.detail_find | {det_postfind}T.detail_postfind | {entry} T.entry | {exit} T.exit | {find} T.find | {initialize} T.initialize | {modify} T.modify | {postfind} T.postfind | {postpath} T.postpath | {path} T.path | {preentry} T.preentry | {preupdate} T.preupdate | {postupdate} T.postupdate | {select} T.select | {update} T.update | {internal} ident ; while_retrieving = T.while T.retrieving ident while_retrieving_opts* T.newline begin_end ; while_retrieving_opts = {backwards} T.backwards | {orderby} T.orderby sorted_ident_list | {sequential} T.sequential | {using} T.using exp_list | {viaindex} T.viaindex ident | {via} T.via ident_list order_type? ; run_command_name = {item} T.item? variable | {string} T.one_string ; run_command_opts = {nowarn} T.nowarn | {response} T.response | {refresh} T.refresh T.all? T.screen? | {clear} P.clear | {on_error} P.on_error ; run_screen_opts = {clear} P.clear | {refresh} P.refresh | {mode} T.mode run_screen_mode | {on_error} P.on_error | {passing} T.passing ident_list ; on_error = T.on T.error run_screen_err_action ; run_screen_mode = {e} e | {f} f | {s} s | {null} null | {same} same ; run_screen_err_action = {continue} continue | {terminate} terminate ; clear = T.clear clear_refresh_opt ; refresh = T.refresh clear_refresh_opt ; clear_refresh_opt = {all} all | {screen} screen | {line} line number to_opt? ; to_opt = to number ; subscreen_options = {label} T.label T.one_string | {passing} T.passing ident_list ; screen_options = {action} T.action screen_label_opt? at_row_col? | {noaction} T.noaction | {activities} T.activities activity activity_list_tail* | {for} T.for number T.line? | {form} T.form ident? | {from} T.from [n1]:number? [c1]:comma [n2]:number to [n3]:number? [c2]:comma [n4]:number | {menu} T.menu | {message} T.message T.on? T.line? number | {mode} T.mode screen_label_opt? at_row_col? | {nomode} T.nomode | {on} T.on T.line? number | {panel} T.panel | {slave} T.slave | {stopscreen} T.stopscreen | {receiving} T.receiving ident_list | {transaction} T.transaction T.model T.optimistic | {window} window on? line? number | {commit_type} screen_commit_type screen_continue_on? ; activity = {entry} T.entry | {find} T.find | {change} T.change | {delete} T.delete ; activity_list_tail = T.comma P.activity ; screen_commit_type = {commit} commit on automatic_commit_point | {nocommit} nocommit ; screen_continue_on = continue on automatic_commit_point ; screen_label_opt = T.label string ; at_row_col = T.at [n1]:T.number? T.comma [n2]:T.number ; automatic_commit_point = {mode} T.mode | {update} T.update | {exit} T.exit ; desc_type = {screen} screen | {field} field? variable ; temp_type = var_type var_size? var_sign ; var_sign = signed? unsigned? var_sign_size? ; var_sign_size = size number bytes? ; temp_options = {when_positive} when_positive | {sum} T.sum T.into ident | {initial} T.initial expression | {occurs} T.occurs temp_occurs_params | {reset} T.reset temp_reset_opt? ; temp_occurs_params = {num} number times? | {with} with item? file? ident ; temp_reset_opt = at temp_reset_mode ; temp_reset_mode = {mode} mode | {startup} startup ; item_options = {final} final define_exp | {initial} initial define_exp fixed? ; access_options = {orderby} T.orderby sorted_ident_list | {nogeneric} T.nogeneric | {optional} T.optional | {sequential} T.sequential | {unique} T.unique | {request} T.request var_list | {using} T.using exp_list | {via} T.via ident_list order_type? | {viaindex} T.viaindex ident ; define_assign = T.equals define_exp ; define_exp = expression define_if? ; define_if = T.if condition define_else? ; define_else = T.else define_exp? ; when_positive = T.when T.positive ; get_options = {generic} T.generic | // TODO: vedere se toglierlo dai pochi sorgenti che lo usano {nogeneric} T.nogeneric | // TODO: vedere se toglierlo dai pochi sorgenti che lo usano {orderby} T.orderby sorted_ident_list | {backwards} T.backwards | {optional} T.optional | {sequantial} T.sequential | {unique} T.unique | {using} T.using exp_list | {viaindex} T.viaindex ident | {via} T.via ident_list order_type? ; field_opts = {bwz} T.bwz | {upshift} T.upshift | {nobwz} T.nobwz | {char} T.character | {date} T.date | {num} T.numeric | {nolabel} T.nolabel | {noshift} T.noshift | {noid} T.noid | {fixed} T.fixed | {help} T.help string | {format} T.format ident | {hidden} T.hidden | {nochange} T.nochange | {nocorrect} T.nocorrect | {noecho} T.noecho | {noentry} T.noentry | {noselect} T.noselect | {pattern} T.pattern string | {picture} T.picture string | {predisplay} T.predisplay | {refresh} T.refresh | {required} T.required | {silent} T.silent | {leading} T.leading T.sign? string | {trailing} T.trailing T.sign? string | {size} T.size number | {separator} T.separator T.one_string | {display} T.display on_entry_or_find? | {label} T.label string? at_row_col? | {input} T.input T.scale? expression | {output} T.output T.scale? expression | {data} T.data T.at [l]:T.number? T.comma [c]:T.number | {values} T.values values_arg | {dynamiclist} T.dynamiclist variable dynamiclist_opt* | {significance1} T.significance number | {significance2} T.sign number | // TODO: Unificare nell'AST? {selectbox} T.selectbox selbox_opt_from? selbox_opt_to? selbox_opt_on?| {hilite} T.hilite T.display hilite_opt* | // field_hilite_if? | {lookup} T.lookup lookup_pars | {for} T.for [n1]:T.number? T.comma [n2]:T.number | {if} T.if condition field_hilite_opt_else? | {id_same} T.id T.same | {id_next} T.id T.next | {id_n} T.id T.number ; dynamiclist_opt = {while} while_retrieving_opts | {onfocus} T.on dynamic_on | {duisplaying} T.displaying variable ; dynamic_on = {startup} T.startup | {focus} T.focus ; selbox_opt_from = T.from [n1]:T.number? T.comma [n2]:T.number ; selbox_opt_to = T.to [n1]:T.number? T.comma [n2]:T.number ; selbox_opt_on = T.on selbox_on_mode ; selbox_on_mode = {request} T.request | {edit} T.edit | {input} T.input ; on_entry_or_find = {on_entry} T.on T.entry | {find} T.find ; field_hilite_if = T.if condition field_hilite_opt_else? ; field_hilite_opt_else = T.else hilite_opt* ; hilite_object = {background} T.background | {display} T.display | {edit} T.edit | {error} T.error | {help} T.help | {id} T.id | {information} T.information | {input} T.input | {label} T.label | {linedrawing} T.linedrawing | {menu} T.menu | {menumark} T.menumark | {message} T.message | {mode} T.mode | {request} T.request | {selectbox} T.selectbox | {severe} T.severe | {title} T.title | {warning} T.warning ; hilite_opt = {ident} ident_list | {color} P.hilite_color | {audible} T.audible | {blinking} T.blinking | {default} T.default | {halftone} T.halftone | {inverse} T.inverse | {off} T.off | {underline} T.underline ; hilite_color = P.color hilite_color_opt? ; hilite_color_opt= T.on P.color ; file_options = {delete} T.delete | {designer} T.designer | {detail} T.detail | {master} T.master | {primary} T.primary | {reference} T.reference | {secondary} T.secondary | {alias} T.alias ident | {close} T.close | {noappend} T.noappend | {nodelete} T.nodelete | {noitems} T.noitems | {open} T.open open_type? open_params T.exclusive? T.share? | {need} T.need number_all | {occurs} T.occurs occurs_params | {transaction} T.transaction T.ident ; occurs_params = {number} T.number T.times? | {with} T.with T.item? T.file? T.ident ; number_all = {number} T.number | {all} T.all ; open_type = {number} T.number | {eachlevel} T.each T.level ; open_params = {append} T.append | {clear} T.clear | {read} T.read | {update} T.update | {write} T.write ; // // Parti comuni a molti comandi // var_size = product number ; assignment = equals expression ; var_list = variable var_list_tail* ; var_list_tail = comma variable ; ident_list = ident ident_list_tail* ; ident_list_tail = comma ident ; sorted_ident_list = ident sort_type? sorted_ident_list_tail* ; sorted_ident_list_tail = comma ident sort_type? ; string_list = string string_list_tail* ; string_list_tail = comma string ; exp_list = expression exp_list_tail* ; exp_list_tail = comma expression ; when_pos_or_neg = when pos_or_neg ; pos_or_neg = {positive} positive | {negative} negative ; incl_or_excl = {included} included | {excluded} excluded ; order_type = ordered sort_type? ; sort_type = {asc} ascending | {desc} descending ; var_type = {zoned} T.zoned | {varchar} T.varchar | {char} T.character | {date} T.date | {numeric} T.numeric | {int} T.integer | {packed} T.packed ; message_x = T.message message_opt ; message_opt = {string} string | {ident} T.equals expression ; string = one_string+ ; lookup_pars = on_or_noton lookup_pars2 lookup_pars_tail* ; lookup_pars2 = ident while_retrieving_opts* T.optional? message_x? ; lookup_pars_tail = {on} T.comma_on lookup_pars2 | {noton} T.comma_noton lookup_pars2 ; on_or_noton = {on} T.on | {not} T.not | {noton} T.noton ; // // Espressioni // condition = {bfactor} andfactor | {or} condition or andfactor ; andfactor = {bfactor} bfactor | {and} andfactor and bfactor ; bfactor = {factor} expression | {relop} [e1]:expression relop [e2]:expression ; expression = {factor} factor | {plus} expression plus factor | {minus} expression minus factor ; factor = {term} simple_expression | {mul} factor product simple_expression | {div} factor div simple_expression | {exp} factor exp simple_expression ; relop = {equals} T.equals | {eq} T.eq | {ne} T.ne | {lt} T.lt | {le} T.le | {ge} T.ge | {gt} T.gt ; unop = {minus} T.minus | {not} T.not ; simple_expression = unop? s_expr P.substring?; substring = l_square_bracket [e1]:expression colon [e2]:expression r_square_bracket; numeric_value = {integer} number | {float} dec_num ; // nibTODO: Visto ke le funzioni sono note a priori, prevedere il controllo del numero dei parametri // gia' nella grammatica per quelle per cui e' possibile s_expr = {integer} T.number | {float} T.dec_num | {string} P.string | {accessok} T.accessok | {changemode} T.changemode | {correctmode} T.correctmode | {entrymode} T.entrymode | {findmode} T.findmode | {selectmode} T.selectmode | {brackets} T.l_par P.condition T.r_par | {func_call} P.function T.l_par exp_list T.r_par | {promptok} T.promptok | {promptokfor} T.promptok_for variable | {newrecord} T.newrecord of_record_optional? | {deletedrecord} T.deletedrecord of_record_optional? | {alteredrecord} T.alteredrecord of_record_optional? | {occurrence} T.occurrence of_record_optional? | {path} T.path | {variable} P.variable ; variable = ident of_record_optional? ; of_record_optional = T.of ident ; // TODO: Unificarle nell'AST function = {absolute} absolute | {ascii} ascii | {ceiling} ceiling | {center} center | {characters} f_characters | {dateextract} dateextract | {days} days | {decrypt} decrypt | {date} date | {deletesysval} deletesystemval | {downshift} downshift | {encrypt} encrypt | {first} first | {floor} floor | {getsystemval} getsystemval | {index} index | {lastday} lastday | {lj} lj | {lower} lower | {matchpattern} matchpattern | {mod} f_mod | {nconvert} nconvert | {oldvalue} oldvalue | {random} random | {rj} rj | {round} round | {setsystemval} setsystemval | {size} size | {substring} T.substring | {sum} sum | {truncate} truncate | {upper} upper | {upshift} upshift | {validpattern} validpattern | {zerofill} zerofill ; color = {red} red | {black} black | {white} white | {blue} blue | {cyan} cyan | {green} green | {magenta} magenta | {yellow} yellow ; values_arg = values_arg1 values_arg_tail* ; values_arg1 = num_or_string values_arg_to? value_caption? ; values_arg_tail = T.comma values_arg1 ; values_arg_to = T.to num_or_string ; value_caption = T.caption T.one_string ; nums_interval_list = nums_interval nums_interval_tail* ; nums_interval_tail = T.comma nums_interval ; nums_interval = [m1]:T.minus? [n1]:numeric_value T.to [m2]:T.minus? [n2]:numeric_value; num_or_string = {integer} minus? number | {float} minus? dec_num | {string} one_string ;