segunda-feira, 27 de fevereiro de 2012

Configurar TextPad para PL/SQL

Serve para qualquer linguagem, desde que o arquivo .SYN seja devidamente configurado.

Crie um arquivo chamado PLSQL.SYN  e salve-o na pasta C:\Program Files\TextPad 5\system. Atente que TextPad 5 pode variar conforme a versão do TextPad.

   1: C=1
   2:  
   3: [Syntax]
   4: Namespace1 = 6
   5: IgnoreCase = Yes
   6: InitKeyWordChars = A-Za-z_
   7: KeyWordChars = A-Za-z0-9_
   8: PreprocStart =
   9: SyntaxStart =
  10: SyntaxEnd =
  11: CommentStart = /*
  12: CommentEnd = */
  13: CommentStartAlt = 
  14: CommentEndAlt = 
  15: SingleComment = --
  16: SingleCommentCol =
  17: StringStart = '
  18: StringEnd = '
  19: StringAlt =
  20: StringEsc =
  21: CharStart = '
  22: CharEnd = '
  23: CharEsc =
  24:  
  25: [Keywords 1]
  26: (+)
  27: all
  28: and
  29: any
  30: as
  31: between
  32: cast
  33: commit
  34: connect by
  35: cube
  36: delete
  37: distinct
  38: exists
  39: explain plan
  40: for update
  41: from
  42: group by
  43: having
  44: in
  45: insert
  46: is null
  47: like
  48: lock table
  49: intersect
  50: multiset
  51: minus
  52: not
  53: or
  54: order by
  55: partition
  56: returning
  57: rollback
  58: rollup
  59: sample
  60: savepoint
  61: select
  62: set constraint
  63: set transaction
  64: some
  65: start with
  66: subpartition
  67: table
  68: the
  69: union
  70: update
  71: values
  72: where
  73: where current of
  74: with
  75:  
  76: [Keywords 2]
  77: abs
  78: acos
  79: add_months
  80: ascii
  81: asin
  82: atan
  83: atan2
  84: avg
  85: bfilename
  86: bitand
  87: ceil
  88: chartorowid
  89: chr
  90: concat
  91: convert
  92: cos
  93: cosh
  94: count
  95: dangling
  96: decode
  97: deref
  98: dump
  99: empty_blob
 100: empty_clob
 101: exists
 102: exp
 103: floor
 104: glb
 105: greatest
 106: grouping
 107: hextoraw
 108: initcap
 109: instr
 110: instrb
 111: last_day
 112: least
 113: length
 114: lengthb
 115: like
 116: ln
 117: log
 118: lower
 119: lpad
 120: ltrim
 121: make_ref
 122: max
 123: min
 124: mod
 125: months_between
 126: new_time
 127: next_day
 128: nls_charset_decl_len
 129: nls_charset_id
 130: nls_charset_name
 131: nls_initcap
 132: nls_lower
 133: nls_upper
 134: nlssort
 135: null
 136: nvl
 137: power
 138: rawtohex
 139: ref
 140: reftohex
 141: replace
 142: round
 143: rowidtochar
 144: rpad
 145: rtrim
 146: sign
 147: sin
 148: sinh
 149: soundex
 150: sqrt
 151: stddev
 152: substr
 153: substrb
 154: sum
 155: sys_context
 156: sys_guid
 157: sysdate
 158: tan
 159: tanh
 160: to_char
 161: to_date
 162: to_lob
 163: to_multi_byte
 164: to_number
 165: translate
 166: trim
 167: trunc
 168: uid
 169: upper
 170: user
 171: userenv
 172: variance
 173: vsize
 174:  
 175: [Keywords 3]
 176: level
 177: currval
 178: nextval
 179: rownum
 180: rowid
 181:  
 182: [Keywords 4]
 183: %found
 184: %isopen
 185: %notfound
 186: %rowcount
 187: %rowtype
 188: %type
 189: authid
 190: autonomous_transaction
 191: begin
 192: bulk collect
 193: bulk collect into
 194: call
 195: close
 196: constant
 197: count
 198: create function
 199: create package
 200: create package body
 201: create procedure
 202: create trigger
 203: create type
 204: create type body
 205: cursor
 206: declare
 207: delete
 208: else
 209: elsif
 210: end
 211: end if
 212: exception
 213: exception_init
 214: execute immediate
 215: exists
 216: exit
 217: extend
 218: fetch
 219: first
 220: for
 221: forall
 222: function
 223: goto
 224: if
 225: insert
 226: into
 227: label
 228: language
 229: last
 230: limit
 231: lock table
 232: loop
 233: map
 234: member
 235: next
 236: null
 237: open
 238: open for
 239: order
 240: pragma
 241: prior
 242: procedure
 243: raise
 244: raise_application_error
 245: record
 246: restrict_references
 247: return
 248: savepoint
 249: self
 250: serially_reusable
 251: set transaction
 252: sql
 253: sqlcode
 254: sqlerrm
 255: subtype
 256: table
 257: then
 258: trim
 259: type
 260: when
 261: where current of
 262: while
 263: varchar2
 264: number
 265: boolean
 266: binary_integer
 267: integer
 268: char
 269: long
 270: blob
 271: clob
 272:  
 273: [Keywords 5]
 274: /
 275: @
 276: @@
 277: accept
 278: attribute
 279: break
 280: btitle
 281: clear
 282: col
 283: column
 284: comp
 285: compute
 286: def
 287: define
 288: exit
 289: ho
 290: host
 291: pause
 292: prompt
 293: rem
 294: remark
 295: repf
 296: repfooter
 297: reph
 298: repheader
 299: run
 300: set
 301: spool
 302: start
 303: sta
 304: timi
 305: timing
 306: ttitle
 307: undef
 308: undefine
 309: var
 310: variable
 311:  
 312: [Keywords 6]
 313: app
 314: appinfo
 315: array
 316: arraysize
 317: autocommit
 318: autop
 319: autoprint
 320: autotrace
 321: blo
 322: blockterminator
 323: cmds
 324: cmdsep
 325: colsep
 326: com
 327: compatibility
 328: con
 329: concat
 330: copyc
 331: copycommit
 332: copytypecheck
 333: echo
 334: esc
 335: escape
 336: feed
 337: feedback
 338: flu
 339: flush
 340: hea
 341: heading
 342: heads
 343: headsep
 344: lines
 345: linesize
 346: long
 347: longchunksize
 348: newpage
 349: numformat
 350: numwidth
 351: pages
 352: pause
 353: recsep
 354: recsepchar
 355: serveroutput
 356: show
 357: showmode
 358: sqlcase
 359: sqlcontinue
 360: sqlnumber
 361: sqlprefix
 362: sqlprompt
 363: suffix
 364: tab
 365: termout
 366: term
 367: time
 368: timing
 369: trim
 370: trimout
 371: underline
 372: verify
 373: wrap

Repare que o Namespace1, linha 4, está definido com o valor 6, porque foi criado seis grupos de sintaxe conforme abaixo:

  1. SQL keywords
  2. SQL functions
  3. Pseudo-columns
  4. PL/SQL keywords
  5. SQL*Plus formatting commands
  6. Other SQL*Plus commands.
No arquivo existe uma linha contendo [keywords 1], [keywords 2] … [keywords 6] e abaixo de cada uma existem a plavaras que sofreram alteração de cor conforme definido em Configure / Preferences / Document Classes / PL/SQL / Colors

Agora vá em:

image

E faça:

image

Depois copie e cole este texto (*.sql, *.fnc, *.pkb, *.pks, *.prc, *.trg, *.tbl) na janela abaixo

image

Selecione Enable syntax highlighting e em Syntax definition file selecione o aquivo que criou e salvou na pasta System do TextPad (PLSQL.SYN)

image

Clique em Next e depois em Finish e pronto, todos os arquivos abertos com a extensões *.sql, *.fnc, *.pkb, *.pks, *.prc, *.trg, *.tbl, terão suas palavras reconhecidas e destacadas confome a configuração default do TextPad.

Para alterar as configurações vá em:

image

Em Document Classes selecione o Document Class Name criado (PL/SQL)  e altere as configurações conforme seu gosto.

image

Um exemplo de como fica o arquivo. (As cores utilizadas não são as padrões)

image

Baseado em: http://mikesmithers.wordpress.com/2010/02/23/plsql-syntax-highlighting-in-textpad-for-when-you-cant-play-with-penguins/

Nenhum comentário :

Postar um comentário

Related Posts Plugin for WordPress, Blogger...