Skip to content

Commit 6326ba3

Browse files
committed
Added block brackets, some keywords, and support for variables to hrc
1 parent 526b129 commit 6326ba3

File tree

5 files changed

+185
-109
lines changed

5 files changed

+185
-109
lines changed

HRC/chatl.hrc

Lines changed: 134 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,134 @@
1-
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
4-
<annotation>
5-
<documentation>
6-
Chat-L Syntax Description
7-
</documentation>
8-
9-
<contributors>
10-
<![CDATA[
11-
Todd Kuebler - original
12-
]]>
13-
</contributors>
14-
</annotation>
15-
16-
<type name="Chat-L">
17-
<region name="Keyword" description="This language's keyword" />
18-
<scheme name="Chat-L">
19-
<keywords region="Keyword">
20-
<word name='topic:' />
21-
<word name='?:' />
22-
<word name='u:' />
23-
<word name='t:' />
24-
</keywords>
25-
<regexp match="/other(keyword)?/i" region="Keyword" />
26-
</scheme>
27-
<region name="String" description="Strings" />
28-
<scheme name="String">
29-
<regexp match="/\\['\\\/]/" region0="Slash" />
30-
</scheme>
31-
<scheme name="Comment">
32-
<block start="/(^|\$?~1)\#/" end="/$/" region="Comment" scheme="def:Comment" />
33-
</scheme>
34-
</type>
35-
36-
37-
</hrc>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
3+
"http://colorer.sf.net/2003/hrc.dtd">
4+
<hrc xmlns="http://colorer.sf.net/2003/hrc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
version="take5"
6+
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
7+
<!--
8+
chatl Syntax
9+
Todd Kuebler <[email protected]>
10+
-->
11+
<type name="chatl">
12+
<import type="def" />
13+
<region name="chatlString" parent="String" />
14+
<region name="chatlArrayNm" parent="StringContent" />
15+
<region name="chatlComment" parent="Comment" />
16+
<region name="chatlSymbol" parent="Symbol" />
17+
<region name="chatlWord" parent="Keyword" />
18+
<region name="chatlVar" parent="Label" />
19+
<region name="chatlVar2" parent="VarStrong" />
20+
<region name="chatlMainSymb" parent="SymbolStrong" />
21+
<region name="chatlToken" paren="KeywordStrong" />
22+
<scheme name="chatl">
23+
<inherit scheme="chatlPairedBrackets">
24+
<virtual scheme="chatlPairedBrackets" subst-scheme="chatl" />
25+
</inherit>
26+
<inherit scheme="chatlVar" />
27+
<inherit scheme="chatlSymbol" />
28+
<regexp match="/(parameter)/" region1="def:Parameter" />
29+
<regexp match="/(varstrong)/" region1="def:VarStrong" />
30+
<regexp match="/(label)/" region1="def:Label" />
31+
<!-- Linear Comments -->
32+
<regexp match="/(#!)(.*)$/" region1="chatlComment" region2="CommentContent" />
33+
<regexp match="/#.*$/" region="chatlComment" />
34+
<!-- Strings -->
35+
<regexp match="/&quot;(\\.|[^\\&quot;])*?&quot;/" region0="chatlString" />
36+
<regexp match="/'(\\.|[^\\'])*?'/" region0="chatlString" />
37+
<!-- matching the Chat-L response type rules -->
38+
<!-- t rule with and without tag -->
39+
<regexp match="/^\s*(t:)\s+([A-Z_]{2,})*\s*(.*)/" region1="Operator" region2="chatlString" />
40+
<regexp match="/^\s*(t:)\s+(.*)/" region1="Operator" />
41+
<!-- rule with tag -->
42+
<regexp match="/^\s*([a-gus\?]:)\s+([A-Z_]{2,})\s+\(\s*(.*?)\s*\)\s+/" region1="Operator"
43+
region2="chatlString" region3="Operator" />
44+
<!-- rule without tag -->
45+
<regexp match="/^\s*([a-gus\?]:)\s+\(\s*(.*?)\s*\)\s+/" region1="Operator"
46+
region2="Operator" />
47+
<!-- find and color the tags in reuse macros -->
48+
<regexp match="/\Mreuse\(([A-Z_]{2,})\)/" region1="chatlString" />
49+
<keywords ignorecase="yes" region="chatlWord">
50+
<word name="topic:" />
51+
<word name="category:" />
52+
<word name="^reuse" />
53+
<word name="reuse" />
54+
<word name="keep()" />
55+
<word name="repeat()" />
56+
<word name="keep" />
57+
<word name="repeat" />
58+
</keywords>
59+
</scheme>
60+
<scheme name="chatlPairedBrackets">
61+
<!-- Paired block -->
62+
<block start="/(\{)/" end="/(\})/" scheme="chatlPairedBrackets" region00="chatlMainSymb"
63+
region01="def:PairStart" region10="chatlMainSymb" region11="def:PairEnd" />
64+
<block start="/(\()/" end="/(\))/" scheme="chatlPairedBrackets" region00="chatlSymbol"
65+
region01="def:PairStart" region10="chatlSymbol" region11="def:PairEnd" />
66+
<block start="/(\[)/" end="/(\])/" scheme="chatlPairedBrackets" region00="chatlMainSymb"
67+
region01="def:PairStart" region10="chatlMainSymb" region11="def:PairEnd" />
68+
</scheme>
69+
<scheme name="chatlSymbol">
70+
<!-- operators -->
71+
<keywords region="chatlSymbol">
72+
<symb name="=" />
73+
<symb name="/" />
74+
<symb name="&amp;" />
75+
<symb name="|" />
76+
<symb name="&gt;" />
77+
<symb name="%" />
78+
<symb name="~" />
79+
<symb name="^" />
80+
<symb name="&lt;" />
81+
<symb name="+" />
82+
<symb name="-" />
83+
<symb name="*" />
84+
<symb name="," />
85+
<symb name="\" />
86+
<symb name="!" />
87+
<symb name=";" />
88+
<word name="::" region="chatlMainSymb" />
89+
</keywords>
90+
</scheme>
91+
<scheme name="chatlVar">
92+
<regexp match="/(\$+\w+)/" region1="chatlVar" />
93+
<regexp match="/(\%+\w+)/" region1="chatlVar" />
94+
</scheme>
95+
<scheme name="chatlToken">
96+
<regexp match="/(\~\w+)/" region1="chatlToken" />
97+
</scheme>
98+
</type>
99+
</hrc>
100+
<!-- ***** BEGIN LICENSE BLOCK *****
101+
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
102+
-
103+
- The contents of this file are subject to the Mozilla Public License Version
104+
- 1.1 (the "License"); you may not use this file except in compliance with
105+
- the License. You may obtain a copy of the License at
106+
- http://www.mozilla.org/MPL/
107+
-
108+
- Software distributed under the License is distributed on an "AS IS" basis,
109+
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
110+
- for the specific language governing rights and limitations under the
111+
- License.
112+
-
113+
- The Original Code is the Colorer Library.
114+
-
115+
- The Initial Developer of the Original Code is
116+
- Cail Lomecb <[email protected]>.
117+
- Portions created by the Initial Developer are Copyright (C) 1999-2005
118+
- the Initial Developer. All Rights Reserved.
119+
-
120+
- Contributor(s):
121+
-
122+
- Alternatively, the contents of this file may be used under the terms of
123+
- either the GNU General Public License Version 2 or later (the "GPL"), or
124+
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
125+
- in which case the provisions of the GPL or the LGPL are applicable instead
126+
- of those above. If you wish to allow use of your version of this file only
127+
- under the terms of either the GPL or the LGPL, and not to allow others to
128+
- use your version of this file under the terms of the MPL, indicate your
129+
- decision by deleting the provisions above and replace them with the notice
130+
- and other provisions required by the LGPL or the GPL. If you do not delete
131+
- the provisions above, a recipient may use your version of this file under
132+
- the terms of any one of the MPL, the GPL or the LGPL.
133+
-
134+
- ***** END LICENSE BLOCK ***** -->

HRC/empty.hrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

RAWDATA/Joe/background.top

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# background
2+
# test
23

34
TOPIC: ~background ( memories past child childhood kid little memory young younger history run_away)
5+
46
#!x This topic is a sample of a simple topic, with good indentation style.
57
#!x It is well commented with annotations for :abstractt and :verify.
68

RAWDATA/Joe/barista.top

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,48 @@
1-
# Barista Character
2-
3-
TOPIC: ~coffee keep repeat (coffee cafe espresso latte macciato cappuccino brew java drip "cold brewed" clover)
4-
5-
# main
6-
t: READY_TO_ORDER () What kind of Coffee would you like today?
7-
#! I do not know
8-
a: (~dunno) I would suggest the latte, it's our specialty.
9-
b: (~yes) Ok, latte it is. $order = latte
10-
b: (~no) ok. you don't want coffee.
11-
#! I do not want coffee
12-
a: ( do not want coffee ) Maybe tea?
13-
#! I want drip, not espresso
14-
a: ( _[drip clover brew "cold brewed"] ) _0 it is. Any pastries today? $order = _0
15-
b: (~yes) ^reuse(FOOD)
16-
#! espresso
17-
a: ( _~coffee ) _0's a good choice, how many shots? $order = _0
18-
b: ( _[two 2 one 1 three 3] ) $shots = _0 [Sure. _0 it is. Anything else?]
19-
[Gottcha, _0. Comin' up. Food?][_0 -nods- Any pastries today?]
20-
c: (~no) K, I'll make your $shot shot $order.
21-
c: FOOD (*) Cherry danish and blueberry scone is all we have left.
22-
d: (~no) K, one $shot shot $order comin' up.
23-
d: ([both each]) K, you get both then. Heated? $pastry = "cherry danish and blueberry scone"
24-
e: () ok.
25-
d: (_["cherry danish" "blueberry scone"]) K, heated or not? $pastry = _0
26-
e: ( ~no ) Alrighty, unheated $pastry.
27-
e: (~yes) I'll nuke your $pastry good.
28-
b: () Whoa, caffeine much? Most I can do in one drink is 4, house rules. $shots = 4
29-
30-
#! Whatcha got?
31-
a: ( ["What do you have" "kinds are there" "what you got" "whatcha got"] ) keep() repeat() The usual, the menu is right up there. ^reuse(READY_TO_ORDER)
32-
33-
t: () [The Machine is pulling great shots today!]
34-
[Man, too many shots today. I'm jittery as hell.]
35-
[Gonna see Crank Dreams tonight, should be a good show]
36-
[Didn't I see you in here yesterday?]
37-
[Busy day today, nice little lull here.]
38-
39-
t: Are you ready to order?
40-
a: (~yes) Ok. ^reuse(READY_TO_ORDER)
41-
42-
s: ( ready to order ) Ok. ^reuse(READY_TO_ORDER)
43-
44-
#! I want a danish
45-
u: ( ~food ) ^reuse(FOOD)
46-
47-
#! what is my order
48-
?: ( what is my order ) if ($order) { Your order is: A $order }
49-
if ($shots) { $shots shots } if ($pastry) { and a $pastry}.
50-
51-
52-
1+
# Barista Character
2+
3+
TOPIC: ~coffee keep() repeat() ( coffee cafe espresso latte macciato cappuccino brew java drip "cold brewed" clover)
4+
5+
t: READY_TO_ORDER() [What kind of Coffee would you like today?][Whatcha havin'?][What Coffee can I get you today?]
6+
#! I do not know
7+
a: (~dunno) I would suggest the latte, it's our specialty.
8+
b: (~yes) Ok, latte it is. $order = latte
9+
b: (~no) ok. you don't want coffee.
10+
#! I do not want coffee
11+
a: ( do not want coffee ) Maybe tea?
12+
#! I want drip, not espresso
13+
a: ( _[drip clover brew "cold brewed"] ) _0 it is. Any pastries today? $order = _0
14+
b: (~yes) ^reuse(FOOD)
15+
#! espresso
16+
a: ( _~coffee ) _0's a good choice, how many shots? $order = _0
17+
b: ( _[two 2 one 1 three 3] ) $shots = _0 [Sure. _0 it is. Anything else?]
18+
[Gottcha, _0. Comin' up. Food?][_0 -nods- Any pastries today?]
19+
c: (~no) K, I'll make your $shot shot $order.
20+
c: FOOD (*) Cherry danish and blueberry scone is all we have left.
21+
d: (~no) K, one $shot shot $order comin' up.
22+
d: ([both each]) K, you get both then. Heated? $pastry = "cherry danish and blueberry scone"
23+
e: () ok.
24+
d: (_["cherry danish" "blueberry scone"]) K, heated or not? $pastry = _0
25+
e: ( ~no ) Alrighty, unheated $pastry.
26+
e: (~yes) I'll nuke your $pastry good.
27+
b: () Whoa, caffeine much? Most I can do in one drink is 4, house rules. $shots = 4
28+
29+
#! Whatcha got?
30+
a: ( ["What do you have" "kinds are there" "what you got" "whatcha got"] ) keep() repeat() The usual, the menu is right up there. ^reuse(READY_TO_ORDER)
31+
32+
t: () [The Machine is pulling great shots today!]
33+
[Man, too many shots today. I'm jittery as hell.]
34+
[Gonna see Crank Dreams tonight, should be a good show]
35+
[Didn't I see you in here yesterday?]
36+
[Busy day today, nice little lull here.]
37+
38+
t: Are you ready to order?
39+
a: (~yes) Ok. ^reuse(READY_TO_ORDER)
40+
41+
s: ( ready to order ) Ok. ^reuse(READY_TO_ORDER)
42+
43+
#! I want a danish
44+
u: ( ~food ) ^reuse(FOOD)
45+
46+
#! what is my order
47+
?: ( what is my order ) if ($order) { Your order is: A $order }
48+
if ($shots) { $shots shots } if ($pastry) { and a $pastry}.

RAWDATA/Joe/simplecontrol.top

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ u: () # main per-sentence processing
2727

2828
if (%length == 0 AND %response == 0 )
2929
{
30-
nofail(TOPIC ^gambit($$currenttopic)) # gambit current topic since no input (usually start of conversation)
30+
nofail(TOPIC ^gambit( $$currenttopic )) # gambit current topic since no input (usually start of conversation)
3131
}
3232

3333
if (%response == 0) { nofail(TOPIC ^respond($$currenttopic)) } # current topic tries to respond to his input

0 commit comments

Comments
 (0)