Skip to content

Commit b13290f

Browse files
committed
---
yaml --- r: 47448 b: refs/heads/try c: 4f3a968 h: refs/heads/master v: v3
1 parent de34a6b commit b13290f

File tree

12 files changed

+104
-359
lines changed

12 files changed

+104
-359
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 0643df28a33f122af9cfbdf49970ab55ae08f106
5+
refs/heads/try: 4f3a968f91bbc2991056e1fb7e6e38829bbce57d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/kate/rust.xml

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE language SYSTEM "language.dtd">
3-
<language name="Rust" version="0.4.0" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
2+
<!DOCTYPE language SYSTEM "language.dtd"
3+
[
4+
<!-- TODO: Kate's regex engine has very limited support for
5+
predefined char classes, so making rustIdent consistent with actual
6+
Rust identifiers will be a bit difficult -->
7+
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
8+
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
9+
]>
10+
<language name="Rust" version="0.6" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
411
<highlighting>
512
<list name="fn">
613
<item> fn </item>
@@ -18,9 +25,7 @@
1825
<item> drop </item>
1926
<item> else </item>
2027
<item> enum </item>
21-
<item> export </item>
2228
<item> extern </item>
23-
<item> fail </item>
2429
<item> for </item>
2530
<item> if </item>
2631
<item> impl </item>
@@ -29,7 +34,6 @@
2934
<item> loop </item>
3035
<item> match </item>
3136
<item> mod </item>
32-
<item> move </item>
3337
<item> mut </item>
3438
<item> priv </item>
3539
<item> pub </item>
@@ -43,6 +47,29 @@
4347
<item> use </item>
4448
<item> while </item>
4549
</list>
50+
<list name="traits">
51+
<item> Const </item>
52+
<item> Copy </item>
53+
<item> Send </item>
54+
<item> Owned </item>
55+
<item> Eq </item>
56+
<item> Ord </item>
57+
<item> Num </item>
58+
<item> Ptr </item>
59+
<item> Drop </item>
60+
<item> Add </item>
61+
<item> Sub </item>
62+
<item> Mul </item>
63+
<item> Div </item>
64+
<item> Modulo </item>
65+
<item> Neg </item>
66+
<item> BitAnd </item>
67+
<item> BitOr </item>
68+
<item> BitXor </item>
69+
<item> Shl </item>
70+
<item> Shr </item>
71+
<item> Index </item>
72+
</list>
4673
<list name="types">
4774
<item> bool </item>
4875
<item> int </item>
@@ -63,6 +90,7 @@
6390
<item> Either </item>
6491
<item> Option </item>
6592
<item> Result </item>
93+
<item> Self </item>
6694
</list>
6795
<list name="ctypes">
6896
<item> c_float </item>
@@ -164,23 +192,33 @@
164192
<keyword String="type" attribute="Keyword" context="Type"/>
165193
<keyword String="keywords" attribute="Keyword" context="#stay"/>
166194
<keyword String="types" attribute="Type" context="#stay"/>
195+
<keyword String="traits" attribute="Trait" context="#stay"/>
167196
<keyword String="ctypes" attribute="CType" context="#stay"/>
168197
<keyword String="self" attribute="Self" context="#stay"/>
169198
<keyword String="constants" attribute="Constant" context="#stay"/>
170199
<keyword String="cconstants" attribute="CConstant" context="#stay"/>
171200
<Detect2Chars char="/" char1="/" attribute="Comment" context="Commentar 1"/>
172201
<Detect2Chars char="/" char1="*" attribute="Comment" context="Commentar 2" beginRegion="Comment"/>
173-
<RegExpr String="0x[0-9a-fA-F_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
174-
<RegExpr String="0b[0-1_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
202+
<RegExpr String="0x[0-9a-fA-F_]+&rustIntSuf;" attribute="Number" context="#stay"/>
203+
<RegExpr String="0b[0-1_]+&rustIntSuf;" attribute="Number" context="#stay"/>
175204
<RegExpr String="[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?" attribute="Number" context="#stay"/>
176-
<RegExpr String="[0-9][0-9_]*(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?" attribute="Number" context="#stay"/>
177-
<RegExpr String="[a-zA-Z_][a-zA-Z0-9_]*::" attribute="Scope"/>
205+
<RegExpr String="[0-9][0-9_]*&rustIntSuf;" attribute="Number" context="#stay"/>
206+
<Detect2Chars char="#" char1="[" attribute="Attribute" context="Attribute" beginRegion="Attribute"/>
207+
<RegExpr String="&rustIdent;::" attribute="Scope"/>
208+
<RegExpr String="&rustIdent;!" attribute="Macro"/>
209+
<RegExpr String="&apos;&rustIdent;(?!&apos;)" attribute="Lifetime"/>
178210
<DetectChar char="{" attribute="Symbol" context="#stay" beginRegion="Brace" />
179211
<DetectChar char="}" attribute="Symbol" context="#stay" endRegion="Brace" />
180212
<DetectChar char="&quot;" attribute="String" context="String"/>
181213
<DetectChar char="&apos;" attribute="Character" context="Character"/>
214+
<DetectChar char="[" attribute="Symbol" context="#stay" beginRegion="Bracket" />
215+
<DetectChar char="]" attribute="Symbol" context="#stay" endRegion="Bracket" />
182216
<DetectIdentifier/>
183217
</context>
218+
<context attribute="Attribute" lineEndContext="#stay" name="Attribute">
219+
<DetectChar char="]" attribute="Attribute" context="#pop" endRegion="Attribute"/>
220+
<IncludeRules context="Normal"/>
221+
</context>
184222
<context attribute="Definition" lineEndContext="#stay" name="Function">
185223
<DetectSpaces/>
186224
<DetectChar char="(" attribute="Normal Text" context="#pop"/>
@@ -193,13 +231,20 @@
193231
</context>
194232
<context attribute="String" lineEndContext="#stay" name="String">
195233
<LineContinue attribute="String" context="#stay"/>
196-
<HlCStringChar attribute="String Char" context="#stay"/>
234+
<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
197235
<DetectChar attribute="String" context="#pop" char="&quot;"/>
198236
</context>
199237
<context attribute="Character" lineEndContext="#pop" name="Character">
200-
<HlCStringChar attribute="Character" context="#stay"/>
238+
<DetectChar char="\" attribute="CharEscape" context="CharEscape"/>
201239
<DetectChar attribute="Character" context="#pop" char="&apos;"/>
202240
</context>
241+
<context attribute="CharEscape" lineEndContext="#pop" name="CharEscape">
242+
<AnyChar String="nrt\&apos;&quot;" attribute="CharEscape" context="#pop"/>
243+
<RegExpr String="x[0-9a-fA-F]{2}" attribute="CharEscape" context="#pop"/>
244+
<RegExpr String="u[0-9a-fA-F]{4}" attribute="CharEscape" context="#pop"/>
245+
<RegExpr String="U[0-9a-fA-F]{8}" attribute="CharEscape" context="#pop"/>
246+
<RegExpr String="." attribute="Error" context="#pop"/>
247+
</context>
203248
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
204249
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
205250
<DetectSpaces/>
@@ -211,6 +256,7 @@
211256
<itemData name="Keyword" defStyleNum="dsKeyword" color="#770088" bold="1"/>
212257
<itemData name="Self" defStyleNum="dsKeyword" color="#FF0000" bold="1"/>
213258
<itemData name="Type" defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
259+
<itemData name="Trait" defStyleNum="dsKeyword" color="#4e9a06" bold="1"/>
214260
<itemData name="CType" defStyleNum="dsNormal" color="#4e9a06"/>
215261
<itemData name="Constant" defStyleNum="dsKeyword" color="#116644"/>
216262
<itemData name="CConstant" defStyleNum="dsNormal" color="#116644"/>
@@ -219,8 +265,12 @@
219265
<itemData name="Scope" defStyleNum="dsNormal" color="#0055AA"/>
220266
<itemData name="Number" defStyleNum="dsDecVal" color="#116644"/>
221267
<itemData name="String" defStyleNum="dsString" color="#FF0000"/>
222-
<itemData name="String Char" defStyleNum="dsChar" color="#FF0000"/>
268+
<itemData name="CharEscape" defStyleNum="dsChar" color="#FF0000" bold="1"/>
223269
<itemData name="Character" defStyleNum="dsChar" color="#FF0000"/>
270+
<itemData name="Macro" defStyleNum="dsOthers"/>
271+
<itemData name="Attribute" defStyleNum="dsOthers"/>
272+
<itemData name="Lifetime" defStyleNum="dsOthers" bold="1"/>
273+
<itemData name="Error" defStyleNum="dsError"/>
224274
</itemDatas>
225275
</highlighting>
226276
<general>

branches/try/src/libcore/io.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ pub trait ReaderUtil {
7878
/// Read len bytes into a new vec.
7979
fn read_bytes(&self, len: uint) -> ~[u8];
8080

81+
/// Read up until a specified character (which is not returned) or EOF.
82+
fn read_until(&self, c: char) -> ~str;
83+
8184
/// Read up until the first '\n' char (which is not returned), or EOF.
8285
fn read_line(&self) -> ~str;
8386

@@ -181,16 +184,22 @@ impl<T:Reader> ReaderUtil for T {
181184
bytes
182185
}
183186

184-
fn read_line(&self) -> ~str {
187+
fn read_until(&self, c: char) -> ~str {
185188
let mut bytes = ~[];
186189
loop {
187190
let ch = self.read_byte();
188-
if ch == -1 || ch == 10 { break; }
191+
if ch == -1 || ch == c as int {
192+
break;
193+
}
189194
bytes.push(ch as u8);
190195
}
191196
str::from_bytes(bytes)
192197
}
193198

199+
fn read_line(&self) -> ~str {
200+
self.read_until('\n')
201+
}
202+
194203
fn read_chars(&self, n: uint) -> ~[char] {
195204
// returns the (consumed offset, n_req), appends characters to &chars
196205
fn chars_from_bytes<T:Reader>(bytes: &~[u8], chars: &mut ~[char])
@@ -262,12 +271,7 @@ impl<T:Reader> ReaderUtil for T {
262271
}
263272

264273
fn read_c_str(&self) -> ~str {
265-
let mut bytes: ~[u8] = ~[];
266-
loop {
267-
let ch = self.read_byte();
268-
if ch < 1 { break; } else { bytes.push(ch as u8); }
269-
}
270-
str::from_bytes(bytes)
274+
self.read_until(0 as char)
271275
}
272276

273277
fn read_whole_stream(&self) -> ~[u8] {

branches/try/src/libsyntax/ext/base.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ pub fn syntax_expander_table() -> SyntaxEnv {
155155
syntax_expanders.insert(@~"deriving_iter_bytes",
156156
@SE(ItemDecorator(
157157
ext::deriving::expand_deriving_iter_bytes)));
158-
syntax_expanders.insert(@~"deriving_clone",
159-
@SE(ItemDecorator(
160-
ext::deriving::expand_deriving_clone)));
161158

162159
// Quasi-quoting expanders
163160
syntax_expanders.insert(@~"quote_tokens",

0 commit comments

Comments
 (0)