Last change
on this file since 25584 was 25584, checked in by davidb, 12 years ago |
Initial cut an a text edit area for GLI that supports color syntax highlighting
|
File size:
1.8 KB
|
Line | |
---|
1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
---|
2 | * Copyright (C) 1998-2009 Gerwin Klein <[email protected]> *
|
---|
3 | * All rights reserved. *
|
---|
4 | * *
|
---|
5 | * This program is free software; you can redistribute it and/or modify *
|
---|
6 | * it under the terms of the GNU General Public License. See the file *
|
---|
7 | * COPYRIGHT for more information. *
|
---|
8 | * *
|
---|
9 | * This program is distributed in the hope that it will be useful, *
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
---|
12 | * GNU General Public License for more details. *
|
---|
13 | * *
|
---|
14 | * You should have received a copy of the GNU General Public License along *
|
---|
15 | * with this program; if not, write to the Free Software Foundation, Inc., *
|
---|
16 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
---|
17 | * *
|
---|
18 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
---|
19 |
|
---|
20 |
|
---|
21 | /**
|
---|
22 | This is a small example of a standalone text substitution scanner
|
---|
23 | It reads a name after the keyword name and substitutes all occurences
|
---|
24 | of "hello" with "hello <name>!". There is a sample input file
|
---|
25 | "sample.inp" provided in this directory
|
---|
26 | */
|
---|
27 |
|
---|
28 | %%
|
---|
29 |
|
---|
30 | %public
|
---|
31 | %class Subst
|
---|
32 | %standalone
|
---|
33 |
|
---|
34 | %unicode
|
---|
35 |
|
---|
36 | %{
|
---|
37 | String name;
|
---|
38 | %}
|
---|
39 |
|
---|
40 | %%
|
---|
41 |
|
---|
42 | "name " [a-zA-Z]+ { name = yytext().substring(5); }
|
---|
43 | [Hh] "ello" { System.out.print(yytext()+" "+name+"!"); }
|
---|
44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.