/* Rexx formatter - checks 1st word on line to determine indentation. */ /****************************************************************************************/ /* Doug nadel, Nadel@us.Ibm.Com */ /****************************************************************************************/ /* Attributes: */ /* Runs on windows and requires object rexx. */ /* Probably runs fine on linux too, Won't run on z/Os or uss because */ /* Object rexx is not available there. It would be easy to make it work there */ /* But since it does not restrict total line length this may not be as */ /* Useful on z/Os */ /* */ /* All output is written to stdout!! */ /* No files are written directly. */ /* Use redirection to save the output to a file. */ /* Eg: Rexxfmt.Rex -cg program.Rex > Newprogram.Rex */ /* */ /* Splits some lines by keyword or semicolon. */ /* Changes keywords to upper case first letter only. */ /* Optionally lower case all variables. */ /* Optionally apply pseudo-sentence case rules to comments on a per line basis. */ /* Intelligently expands block comment lines ending in chars: -=*~#_+ */ /* Line comments are lined up against right side. */ /* Spaces are added around operators for readability. */ /* Blank lines are added around full line comments. */ /* Blank lines are retained but reduce to a maximum of one blank line. */ /* When a label includes procedure on the same line and the previous line is not */ /* Blank or a comment, A comment is inserted with the subroutine name */ /* */ /* Restrictions: */ /* This is not a real parser. It is a simple forward scanner.. */ /* */ /* Can join most continued lines, But will not split lines to meet max length. */ /* Formatter does not join statements such as a then on a subsequent line. */ /* Comments within comments may cause formatting errors. */ /* Subroutine comments (See above) Don't get added if procedure is not on same line. */ /* Multiline comments are supported, Though formatting may be lost. */ /* Lines that end with a commaa followed by a comment or string may cause the */ /* Following line to be indented because this is mistaken for a continuation */ /* */ /* Customization: */ /* See setdefaults routine for what can be changed */ /* */ /* Support and warranty: */ /* No warranty or support is provided by the author or any other party. */ /* */ /*--------------------------------------------------------------------------------------*/ /*Syntax: Rexxfmt.Rex [Options] Program-file-name */ /*--------------------------------------------------------------------------------------*/ /* -e num : Comment right column (Default 90) */ /* -p num : Line comment length offset from right (Default 40) */ /* -i num : Indentation (Default 2) */ /* -pi num : Post-label indentation (Default 3) */ /* */ /* -j : Join lines that end with comma before processing */ /* -ncc : Do not change the case of comments */ /* -lc : Lowercase all non-keyword symbols */ /* -cc : Compress comments */ /* -cq : Change single quoted strings to double where possible */ /* -o : Write to rexxfmt.Output.Rex instead of stdout */ /*--------------------------------------------------------------------------------------*/ Signal On Novalue parms. = 0 /* Default parms */ Parse Arg parms.INPUT_ARGS Call setParameters /* Indent words print and then indent. */ indentwords = "do select"~translate /* Outdent words print and don't indent. If also indent word, Indent is after outdent */ outdentwords = "end"~translate /* Need something for procedures -- later */ ontimeindentwords = "when otherwise"~translate barrierType. = "" /* Indicates whether in if statement */ barrierDepth = 0 /* Barriers handle indentation */ barrierIndent. = 0 /* Indentation at each level */ lastLineBlank = 1 /* Was last line blank? */ lastLineComment = 0 /* Was last line a comment? */ continuation = 0 /* Rememberd state of line continuation */ newlineAfterWords = "then else otherwise"~translate /* Force line break after */ newlineBeforeWords = indentwords outdentwords /* Force line break before */ parms.foundLabel = 0 /* When 1, Indent all but labels */ trtable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ$#@0123456789_" /* Translate table for characters */ trtable = translate(xrange("00"x,"FF"x),,trtable," ") /* Valid in names and keywords */ file = .stream~new(parms.filename) Call removeCommentsAndQuotedStrings("reset") /*--------------------------------------------------------------------------------------*/ /* Start of main logic */ /*--------------------------------------------------------------------------------------*/ /* Check for linux script line and don't change it if it is there */ firstline = file~linein If firstline~substr(1,2) <> "#!" Then file~close Else Do Call writeline firstline Call writeline "" End /* Formatting starts here */ Do While file~lines <> 0 /* Read lines from source file */ line = "" Do Until nocomma /* Optionally loop through continuations */ nocomma = 1 line = line file~linein If line~strip~substr(1,2) == "--" Then Do line = line~strip Iterate End line = line~translate(" ","09"x)~strip line = compressedLine(line)~strip("T") If parms.JOIN_COMMA_SEPARATED_LINES Then If (" "line)~reverse~substr(1,1) = "," Then Do line = line~delstr(line~length) nocomma = 0 End End Call removeCommentsAndQuotedStrings("process") /*--------------------------------------------------------------------------------------*/ /* Split lines on keywords like before do, After semicolons, Etc */ /*--------------------------------------------------------------------------------------*/ workOrig = workLine workLine = translate(workline~translate,,trtable," ") /* Remove non-kwd chars */ If line <> "" Then Do While line <> "" split = workline~length + 1 Do a = 1 to words(newlineBeforeWords) p = wordpos(word(newlineBeforeWords,a),workLine,2) If p > 0 Then Do p = wordindex(workLine,p) split = min(split,p) End End Do a = 1 to words(newlineAfterWords) /* Commmm */ checkWord = word(newlineAfterWords,a) p = wordpos(checkWord,workLine) If p > 0 Then Do p = wordindex(workLine,p) + checkWord~length If p < line~length Then /* Must include line comment */ Do s = verify(workline," ",,p) If s = 0 Then s = line~length + 1 p = max(p,s) End split = min(split,p) End End p = pos(";",workOrig) If p > 0 Then Do p = p + 1 next = verify(workorig," ",,p) If next > 0 Then p = next; Else p = workorig~length + 1 /* Take rest of line in case of comment */ split = min(split,p) End Interpret "parse var line q " split "line" Interpret "parse var workline inspectionLine " split "workline" Interpret "parse var workOrig current " split "workOrig" current = " " || current~strip cont = "," == current~substr(current~length) c = q~substr(q~length) cont = cont & (c <> "'" & c <> '"') Call processLine q,inspectionLine, cont End Else /* Process empty line */ Do Call processLine line,workline,0 End End file~close If parms.OUTPUT_TO_FILE Then Do fileout = .stream~new("c:\temp\rexxfmt.output.rex") fileout~open("write replace") Do i = 1 to parms.OUTPUT_CONTENT.0 fileout~lineout(parms.OUTPUT_CONTENT.i) End fileout~close End Return /*--------------------------------------------------------------------------------------*/ /* Processline: Examine lines enough to figure out how to indent */ /* Lines. Also add blank lines or comments as needed. */ /*--------------------------------------------------------------------------------------*/ processLine: Procedure Expose parms. indentwords outdentwords ontimeindentwords , barrierType. barrierDepth barrierIndent. trtable incomment , insquote indquote lastLineBlank lastLineComment , lastContinuation continuation lastContinuation = continuation line = Arg(1) workline = Arg(2) continuation = Arg(3) blankOrComment = 0 commentStart = Arg(1)~lastpos("/*") commentEnd = Arg(1)~lastpos("*/") If Arg(1)~space~strip = "" Then blankOrComment = 1 Else If commentStart > 0 & commentEnd > 0 Then If Arg(1)~delstr(commentStart,CommentEnd + 2)~strip = "" Then Do blankOrComment = 1; lastLineComment = 1; End If blankOrcomment Then Do If (\lastLineBlank) Then Call write "" If ("" <> Arg(1)~strip) Then Call write copies(" ",barrierIndent.barrierDepth) || Arg(1) lastLineBlank = 1 Return End Else If lastLineComment Then Call write "" Else If wordpos("PROCEDURE",workline) > 1 Then Do If (\lastlineblank) Then Do Parse Var line pr ":" . Parse Var pr pr . Call write "" Call write "/*--- "pr" "copies("-",parms.full_line_comment_length - 9 - pr~length)"*/" Call write "" End End Else Do Parse Var line pr ":" . If words(pr) = 1 & line~pos(":") > 0 Then If (\lastlineblank) Then Do Parse Var line pr ":" . Parse Var pr pr . Call write "" End End lastLineComment = 0; lastLineBlank = 0 /* Do a = Barrierdepth to 1 by - 1 Say '[ Barriertype.'a' = ' barriertype.A']' End */ firstWord = word(workLine,1) written = 0 If (\lastcontinuation) Then Do If barrierType.barrierDepth = "endif" Then Do While barrierType.barrierDepth = "endif" barrierDepth = barrierDepth - 1 If barrierType.barrierDepth = "waitforelse" & firstWord \= "ELSE" Then barrierType.barrierDepth = "endif" End If firstWord <> "ELSE" Then Do If barrierType.barrierDepth = "waitforelse" Then barrierType.barrierDepth = "endif" Do While barrierType.barrierDepth = "endif" barrierDepth = barrierDepth - 1 If barrierType.barrierDepth = "else" | barrierType.barrierDepth = "waitforelse" Then barrierType.barrierDepth = "endif" End End If firstWord = "IF" Then Do If barrierType.barrierDepth = "if" Then barrierType.barrierDepth = "waitforelse" Else If barrierType.barrierDepth = "else" Then barrierType.barrierDepth = "endif" Call write copies(" ",barrierIndent.barrierDepth) || line written = 1 indent = barrierIndent.barrierDepth; barrierDepth = barrierDepth + 1; barrierIndent.barrierDepth = indent + parms.BASE_INDENTATION barrierType.barrierDepth = "if" End If barrierType.barrierDepth = "waitforelse" Then If firstWord = "ELSE" Then Do Call write copies(" ",max(0,barrierIndent.barrierDepth - parms.BASE_INDENTATION)) || line written = 1 barrierType.barrierDepth = "else" End Else barrierType.barrierDepth = "endif" If barrierType.barrierDepth = "endif" Then Do While barrierType.barrierDepth = "endif" barrierDepth = barrierDepth - 1 If barrierType.barrierDepth = "waitforelse" & firstWord \= "ELSE" Then barrierType.barrierDepth = "endif" End If firstWord = "END" Then Do barrierDepth = barrierDepth - 1 Call write copies(" ",barrierIndent.barrierDepth) || line written = 1 End If (\written) Then If 0 < wordpos(firstWord,indentwords) Then Do If (\written) Then Call write copies(" ",barrierIndent.barrierDepth) || line If barrierType.barrierDepth = "if" Then barrierType.barrierDepth = "waitforelse" Else If barrierType.barrierDepth = "else" Then barrierType.barrierDepth = "endif" indent = barrierIndent.barrierDepth; barrierDepth = barrierDepth + 1; If firstWord <> "SELECT" Then barrierIndent.barrierDepth = indent + parms.BASE_INDENTATION Else barrierIndent.barrierDepth = indent + parms.BASE_INDENTATION * 2 barrierType.barrierDepth = "do" written = 1 End If (\written) Then Do i = barrierIndent.barrierDepth; If 0 < wordpos(firstWord,ontimeindentwords) Then i = max(i - parms.BASE_INDENTATION,0) Call write copies(" ",i) || line If barrierType.barrierDepth = "if" Then barrierType.barrierDepth = "waitforelse" Else If barrierType.barrierDepth = "else" Then barrierType.barrierDepth = "endif" End End Else Do Call write copies(" ",barrierIndent.barrierDepth + 4) || line End Return /*--- write ----------------------------------------------------------------------------*/ write: Procedure Expose parms. barrierIndent. barrierDepth line = Arg(1) colon = pos(":",line) line1 = "" If colon > 0 Then line1 = line~substr(1,colon) If (colon > 1) & 0 == pos('"',line1) & 0 = pos("'",line1) Then Do Parse Var line label ":" rest If words(label) = 1 & barrierDepth = 0 & "/*" <> label~substr(1,2) Then Do parms.foundLabel = 1 barrierIndent.barrierDepth = parms.PROC_INDENTATION line = label~strip || ": " || rest~strip("L") End End workline = line~strip If parms.ALTER_COMMENTS Then Do If workline~substr(1,2) = "/*" & workline~lastpos("*/") = workline~length - 1 Then Do Parse Value line With "/*" c "*/" If length(c) = 1 Then c = c || c If (c~length > 1) Then If ( substr(c,2) == delstr(c,c~length) ) Then c = "/*"c~substr(1,1)~copies(parms.FULL_LINE_COMMENT_LENGTH - 4)"*/" Else Do chr = c~substr(c~length) If pos(chr,"-=*~#_+ ") <> 0 Then Do c = c~left(max(parms.FULL_LINE_COMMENT_LENGTH - 4,1 + c~strip("T",chr)~length),chr) c = "/*"c"*/" End Else c = "/*"c~left(max(parms.FULL_LINE_COMMENT_LENGTH - 4,c~strip("T")~length))"*/" End Else c = "/*"c~left(max(parms.FULL_LINE_COMMENT_LENGTH - 4,c~strip("T")~length))"*/" Call writeLine c Return End Else /* End of line comment */ If line~length > 2 Then If "*/" = line~substr(line~length - 1,2) Then Do p = line~lastpos("/*") If p > 1 Then If substr(line,1,p - 1)~strip <> "" Then Do code = line~substr(1,p - 1)~strip("T") comm = line~delstr(1,p - 1) Parse Var comm "/*" comm "*/" comm = comm~strip amountLeft = min(parms.FULL_LINE_COMMENT_LENGTH - 7 - code~length,parms.PART_LINE_COMMENT_LENGTH - 6 ) comm = left(comm,max( amountLeft ,comm~length)) line = left(code,max(code~length,parms.FULL_LINE_COMMENT_LENGTH - 6 - length(comm))) || "/* "comm" */" Call writeLine line Return End c = line~substr(1,line~length - 2) c = c~left(max(parms.FULL_LINE_COMMENT_LENGTH - 2,c~strip("T")~length))"*/" Call writeLine c Return End End Else If parms.COMPRESS_COMMENTS Then Do p = pos("/*",line) If p > 0 & pos("*/",line) > p + 1 Then Do Parse Value line With s "/*" c "*/" e Call writeLine s || "/*" || space(c) || "*/"e End Else Call writeline line Return End Call writeLine line Return /*--- writeline ------------------------------------------------------------------------*/ writeLine: Procedure Expose parms. line = Arg(1) indent = verify(line," ") first = 1 Do While line <> "" | first = 1 first = 0 nextline = "" If line~length > parms.FULL_LINE_COMMENT_LENGTH Then Do p = verify(line~substr(1,parms.FULL_LINE_COMMENT_LENGTH)~reverse," ,-+)","M") If 0 & p > 0 Then Do p = parms.FULL_LINE_COMMENT_LENGTH - p nextline = line~delstr(1,p) line = line~substr(1,p)"," End End If parms.OUTPUT_TO_FILE Then Do i = parms.OUTPUT_CONTENT.0 + 1 parms.OUTPUT_CONTENT.0 = i parms.OUTPUT_CONTENT.i = line End Else Say line line = copies(" ",indent + 4) || nextline End Return /*--- compressedline -------------------------------------------------------------------*/ compressedLine: Procedure Expose parms. incomment line = Arg(1) lineIndex = 1 token = nextToken(line,lineIndex) linex = token lineIndex = lineIndex + (token~length) tokenOK = (token \== "") Do While tokenOK token = nextToken(line,lineIndex) tokenOK = (token \== "") lineIndex = lineIndex + (token~length) If token = " " Then token = " "; If op Then token = " "token" " If " " == linex~substr(linex~length) Then token = strip(token,"L") linex = linex || token End Return linex /*--- nexttoken ------------------------------------------------------------------------*/ nextToken: Procedure Expose parms. op incomment line = Arg(1) lineIndex = Arg(2) op = 0 p = verify(line," ",,lineIndex) If p > lineIndex Then Return substr(line,lineIndex, p - lineIndex) If lineIndex > length(line) Then Do Return "" End t1 = "= - * + % / < > & |" t1w = words(t1) t2 = "== <> <= => \= // || &&" t2w = words(t2) symchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@_.?!0123456789" test = line~substr(lineIndex,2) If incomment > 0 | test = "/*" Then Do prefix = "" If incomment > 0 Then prefix = " " p = pos("*/",line,lineIndex + 2) If p > 0 Then comment = line~substr(lineIndex,p - lineIndex + 2) Else comment = substr(line,lineIndex) If parms.COMMENT_CASE Then Do len = comment~length comment = comment~translate("abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") newc = "" cap = 1 Do a = 1 to len Parse Var comment c 2 comment alpha = 0 < pos(c,"'-abcdefghijklmnopqrstuvwxyz0123456789@") If cap & alpha Then Do newc = newc || c~translate cap = 0 End Else Do If (\alpha) & c <> " " Then cap = 1 newc = newc || c End End comment = newc End Return prefix || comment End If line~substr(lineIndex,3) = "\==" Then Do op = 1 Return "\==" End If 0 <> wordpos(test,t2) Then Do op = 1 Return test End test = line~substr(lineIndex,1) If test = '"' Then Do p = pos('"',line,lineIndex + 1) If p > 0 Then Return line~substr(lineIndex,p - lineIndex + 1) Else Return substr(line,lineIndex) End If test = "'" Then Do p = pos("'",line,lineIndex + 1) If p > 0 Then comment = line~substr(lineIndex,p - lineIndex + 1) Else comment = substr(line,lineIndex) If parms.CHANGE_SINGLE_TO__DOUBLE_QUOTES = 1 & pos('"',comment) = 0 Then comment = comment~translate('"',"'") Return comment End If 0 <> pos(test~translate,symchars) Then Do p = verify(line~translate,symchars,,lineIndex) If p = 0 Then /* Rest of line is symbol or number */ token = substr(line,lineIndex) Else If p > lineIndex Then /* Found symbol followed by ? */ token = substr(line,lineIndex, p - lineIndex) Else If 0 <> wordpos(test,t1) Then Do op = 1 Return test End Else Return test If wordpos(token~translate,parms.KEYWORDS) > 0 Then token = token~substr(1,1)~translate || token~delstr(1,1)~translate( , "abcdefghijklmnopqrstuvwxyz",, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") Else If wordpos(token~translate,parms.FUNCTIONS) > 0 Then token = token~translate( "abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") Else If wordpos(token~translate,parms.BUILTINST) > 0 Then token = word(parms.BUILTINS,wordpos(token~translate,parms.BUILTINST)) Else If parms.LOWER_CASE_SYMBOLS = 1 Then token = token~translate("abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") Return token End Else If 0 <> wordpos(test,t1) Then Do op = 1 Return test End Else Return test Return test /*--- setparameters --------------------------------------------------------------------*/ setParameters: Procedure Expose parms. Call setDefaults parms.KEYWORDS = parms.KEYWORDS~translate parms.FUNCTIONS = parms.FUNCTIONS ~translate parms.BUILTINST = parms.BUILTINS~translate parms.OUTPUT_CONTENT. = "" parms.OUTPUT_CONTENT.0 = 0 inparms = parms.INPUT_ARGS wc = words(inparms) If wc = 0 Then Call err "Invalid file name" Parse Var inparms part1 '"' fn '"' part2 If fn <> "" Then Do parms.filename = fn inparms = part1 part2 "*UNUSED*" wc = words(inparms) End Else parms.filename = word(inparms,wc) If parms.filename~substr(1,1) == "-" Then Call err "Missing file name. File name must come after flags." file = .stream~new(parms.filename) If file~query("exists") = "" Then Call err parms.filename "does not exist." Do f = 1 to wc - 1 flag = word(inparms,f) Select When flag = "-e" Then Do If f < wc - 1 & 1 = datatype(word(inparms,f + 1),"N") Then Do parms.FULL_LINE_COMMENT_LENGTH = 0 + word(inparms,f + 1) f = f + 1 End Else Call err flag End When flag = "-p" Then Do If f < wc - 1 & 1 = datatype(word(inparms,f + 1),"N") Then Do parms.PART_LINE_COMMENT_LENGTH = 0 + word(inparms,f + 1) f = f + 1 End Else Call err flag End When flag = "-i" Then Do If f < wc - 1 & 1 = datatype(word(inparms,f + 1),"N") Then Do parms.BASE_INDENTATION = max(0,0 + word(inparms,f + 1)) parms.BASE_INDENTATION = min(parms.BASE_INDENTATION,10) f = f + 1 End Else Call err flag End When flag = "-pi" Then Do If f < wc - 1 & 1 = datatype(word(inparms,f + 1),"N") Then Do parms.PROC_INDENTATION = max(0,0 + word(inparms,f + 1)) parms.PROC_INDENTATION = min(parms.PROC_INDENTATION,10) f = f + 1 End Else Call err flag End When flag = "-cq" Then parms.CHANGE_SINGLE_TO__DOUBLE_QUOTES = 1 When flag = "-j" Then parms.JOIN_COMMA_SEPARATED_LINES = 1 When flag = "-lc" Then parms.LOWER_CASE_SYMBOLS = 1 When flag = "-o" Then parms.OUTPUT_TO_FILE = 1 When flag = "-ncc" Then parms.COMMENT_CASE = 0 When flag = "-cc" Then Do parms.COMPRESS_COMMENTS = 1 parms.ALTER_COMMENTS = 0 End Otherwise Call err "Unknown option :" flag End End parms.FULL_LINE_COMMENT_LENGTH = max(parms.FULL_LINE_COMMENT_LENGTH,50) parms.PART_LINE_COMMENT_LENGTH = min(parms.PART_LINE_COMMENT_LENGTH,parms.FULL_LINE_COMMENT_LENGTH - 10) parms.PART_LINE_COMMENT_LENGTH = max(parms.PART_LINE_COMMENT_LENGTH,10) Return /*--- err ------------------------------------------------------------------------------*/ err: Procedure Expose parms. Parse source . . me . me = me~delstr(1,me~lastpos("\")) stuff = Arg(1) If stuff~substr(1,1) = "-" Then stuff = "Error with option " || stuff Call setDefaults Say "-"~copies(70) Say stuff Say parms.INPUT_ARGS Say "-"~copies(70) Say "Syntax: "me" [options] program-file-name" Say "-"~copies(70) Say " -e num : Comment right column (default "parms.FULL_LINE_COMMENT_LENGTH")" Say " -p num : Line comment length offset from right (default "parms.PART_LINE_COMMENT_LENGTH")" Say " -i num : Indentation (default "parms.BASE_INDENTATION")" Say " -pi num : Post-label indentation (default "parms.PROC_INDENTATION")" Say Say " -j : Join lines that end with comma before processing" Say " -lc : Lowercase all non-keyword symbols" Say " -ncc : Do not change the case of comments" Say " -cc : Compress comments" Say " -cq : Change single quoted strings to double where possible" Say " -o : Write to rexxfmt.output.rex instead of stdout" Say "-"~copies(70) Exit /*--------------------------------------------------------------------------------------*/ /* Scan through the current line, Creating workline which contains */ /* The content minus quoted strings and comments. This is */ /* So that we can check for keywords, Tokens, Etc without false */ /* Hits within strings and comments. */ /*--------------------------------------------------------------------------------------*/ removeCommentsAndQuotedStrings: Procedure Expose line workline insquote indquote incomment If Arg(1) = "reset" Then Do incomment = 0 /* Comment indicator (Numeric) */ insquote = 0 /* Single quote indicator (Binary) */ indquote = 0 /* Double quote indicator (Binary) */ End Else Do workline = line Do a = 1 to line~length If 0 = (insquote + indquote) Then Do If line~substr(a,2) = "/*" Then Do workline = overlay(" ",workline,a) incomment = incomment + 1 End Else If line~substr(a,2) = "*/" Then Do workline = overlay(" ",workline,a) incomment = max(0,incomment - 1) End Else If incomment = 0 Then Do If line~substr(a,1) = "'" Then insquote = 1 Else If line~substr(a,1) = '"' Then indquote = 1 End End Else If indquote & line~substr(a,1) = '"' Then Do workline = overlay(" ",workline,a) indquote = 0 End Else If insquote & line~substr(a,1) = "'" Then Do workline = overlay(" ",workline,a) insquote = 0 End If (0 < insquote + indquote + incomment) Then workline = overlay(" ",workline,a) Else If line~substr(a,1) = ";" Then workline = overlay(";",workline,a) End End Return /*--- setdefaults ----------------------------------------------------------------------*/ setDefaults: Procedure Expose parms. parms.ALTER_COMMENTS = 1 /* Change comment length, Lineup */ parms.COMPRESS_COMMENTS = 0 /* Leave ugly comments */ parms.FULL_LINE_COMMENT_LENGTH = 90 /* Position of comment close */ parms.PART_LINE_COMMENT_LENGTH = 40 /* Preferred line comment ione col */ parms.JOIN_COMMA_SEPARATED_LINES = 0 /* Join comma breaks */ parms.CHANGE_SINGLE_TO__DOUBLE_QUOTES = 0 /* Standardize on double quotes */ parms.LOWER_CASE_SYMBOLS = 0 /* Lower case everything but keywords */ parms.BASE_INDENTATION = 2 /* Indentation in structure */ parms.PROC_INDENTATION = 3 /* Indentation after 1st label */ parms.COMMENT_CASE = 1 /* Smart comment recasing */ parms.OUTPUT_TO_FILE = 0 /* Write to file not stdout */ /*--------------------------------------------------------------------------------------*/ /* These keywords will always be changed to 1st letter upper case and the */ /* Rest of the word lower case. */ /*--------------------------------------------------------------------------------------*/ parms.KEYWORDS = "if then else do while until forever iterate leave end select" parms.KEYWORDS = parms.KEYWORDS "when otherwise queue push pull arg drop parse call" parms.KEYWORDS = parms.KEYWORDS "exit return procedure expose interpret numeric digits" parms.KEYWORDS = parms.KEYWORDS "var with nop say trace address upper value" parms.KEYWORDS = parms.KEYWORDS "signal on error novalue syntax halt" /*--------------------------------------------------------------------------------------*/ /* These words will always be lower case */ /*--------------------------------------------------------------------------------------*/ parms.FUNCTIONS = "abbrev abs address arg beep bitand bitor bitxor" parms.FUNCTIONS = parms.FUNCTIONS "b2x center changestr charin charout chars" parms.FUNCTIONS = parms.FUNCTIONS "compare condition copies countstr c2d c2x" parms.FUNCTIONS = parms.FUNCTIONS "datatype date delstr delword digits directory" parms.FUNCTIONS = parms.FUNCTIONS "d2c d2x endlocal errortext filespec form format" parms.FUNCTIONS = parms.FUNCTIONS "fuzz insert lastpos left length linein lineout" parms.FUNCTIONS = parms.FUNCTIONS "lines max min overlay pos queued random reverse" parms.FUNCTIONS = parms.FUNCTIONS "right sign setlocal sourceline space storage stream" parms.FUNCTIONS = parms.FUNCTIONS "query strip substr subword symbol time trace" parms.FUNCTIONS = parms.FUNCTIONS "translate trunc userid value var verify word" parms.FUNCTIONS = parms.FUNCTIONS "wordindex wordlength wordpos words xrange x2b" parms.FUNCTIONS = parms.FUNCTIONS "x2c x2d" /*--------------------------------------------------------------------------------------*/ /* These words will always remain as listed here */ /*--------------------------------------------------------------------------------------*/ parms.BUILTINS = parms.BUILTINS "RxFuncAdd RxFuncDrop RxFuncQuery RxQueue" parms.BUILTINS = parms.BUILTINS "RxMessageBox RxWinExec SysAddFileHandle" parms.BUILTINS = parms.BUILTINS "SysAddRexxMacro SysBootDrive" parms.BUILTINS = parms.BUILTINS "SysClearRexxMacroSpace SysCloseEventSem" parms.BUILTINS = parms.BUILTINS "SysCloseMutexSem SysCls SysCreateEventSem" parms.BUILTINS = parms.BUILTINS "SysCreateMutexSem SysCreatePipe SysCurPos" parms.BUILTINS = parms.BUILTINS "SysCurState SysDriveInfo SysDriveMap" parms.BUILTINS = parms.BUILTINS "SysDropFuncs SysDropLibrary SysDropRexxMacro" parms.BUILTINS = parms.BUILTINS "SysDumpVariables SysFileDelete SysFileSearch" parms.BUILTINS = parms.BUILTINS "SysFileSystemType SysFileTree SysFork" parms.BUILTINS = parms.BUILTINS "SysFromUnicode SysGetCollate SysGetErrortext" parms.BUILTINS = parms.BUILTINS "SysGetFileDateTime SysGetKey SysGetMessage" parms.BUILTINS = parms.BUILTINS "SysGetMessageX SysIni SysLoadFuncs" parms.BUILTINS = parms.BUILTINS "SysLoadRexxMacroSpace SysMapCase SysMkDir" parms.BUILTINS = parms.BUILTINS "SysNationalLanguageCompare SysOpenEventSem" parms.BUILTINS = parms.BUILTINS "SysOpenMutexSem SysPostEventSem SysProcessType" parms.BUILTINS = parms.BUILTINS "SysPulseEventSem SysQueryProcess" parms.BUILTINS = parms.BUILTINS "SysQueryProcessCodePage SysQueryRexxMacro" parms.BUILTINS = parms.BUILTINS "SysReleaseMutexSem SysReorderRexxMacro" parms.BUILTINS = parms.BUILTINS "SysRequestMutexSem SysResetEventSem SysRmDir" parms.BUILTINS = parms.BUILTINS "SysSaveRexxMacroSpace SysSearchPath" parms.BUILTINS = parms.BUILTINS "SysSetFileDateTime SysSetPriority" parms.BUILTINS = parms.BUILTINS "SysSetProcessCodePage SysShutdownSystem SysSleep" parms.BUILTINS = parms.BUILTINS "SysStemCopy SysStemDelete SysStemInsert" parms.BUILTINS = parms.BUILTINS "SysStemSort SysSwitchSession SysSystemDirectory" parms.BUILTINS = parms.BUILTINS "SysTempFileName SysTextScreenRead" parms.BUILTINS = parms.BUILTINS "SysTextScreenSize SysToUnicode SysUtilVersion" parms.BUILTINS = parms.BUILTINS "SysVersion SysVolumeLabel SysWait" parms.BUILTINS = parms.BUILTINS "SysWaitEventSem SysWaitNamedPipe SysWildCard" parms.BUILTINS = parms.BUILTINS "SysWinDecryptFile SysWinEncryptFile" parms.BUILTINS = parms.BUILTINS "SysWinVerWindowsonly) SysWinGetPrinters" parms.BUILTINS = parms.BUILTINS "SysWinGetDefaultPrinter SysWinSetDefaultPrinter" Return