Permalink
Browse files

adding function name matching and corresponding symbol lookup

  • Loading branch information...
dbp committed Aug 11, 2012
1 parent 1deefa0 commit 73d2d07a45a589be8458123b6a7ab241f130314d
Showing with 84 additions and 18 deletions.
  1. +18 −2 Rust.JSON-tmLanguage
  2. +44 −16 Rust.tmLanguage
  3. +5 −0 RustSymbols.JSON-tmPreferences
  4. +17 −0 RustSymbols.tmPreferences
View
@@ -18,8 +18,24 @@
{"include": "#rust_escaped_character"}
]
},
+ {"name": "meta.function.source.rust",
+ "match": "\\b(fn)\\s+([a-zA-Z_]\\w*)\\s*(\\()",
+ "captures": {
+ "1": {"name": "keyword.source.rust"},
+ "2": {"name": "entity.name.function.source.rust"}
+ },
+ "comment": "functions with types"
+ },
+ {"name": "meta.function.source.rust",
+ "match": "\\b(fn)\\s+([a-zA-Z_]\\w*)\\s*(\\()",
+ "captures": {
+ "0": {"name": "keyword.source.rust"},
+ "1": {"name": "entity.name.function.source.rust"}
+ },
+ "comment": "functions without types"
+ },
{"name": "keyword.source.rust",
- "match": "\\b(again|as|break|check|claim|const|copy|do|drop|else|export|extern|fail|for|if|impl|import|in|let|log|loop|match|mod|module|move|mut|new|of|owned|priv|pub|pure|return|to|unchecked|use|while|with|mod|trait|class|struct|enum|type|fn)\\b"
+ "match": "\\b(again|as|break|check|claim|const|copy|do|drop|else|export|extern|fail|for|if|impl|import|in|let|log|loop|match|mod|module|move|mut|new|of|owned|priv|pub|pure|return|to|unchecked|use|while|with|mod|trait|class|struct|enum|type)\\b"
},
{"name": "storage.type.source.rust",
"match": "\\b(m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b"
@@ -46,7 +62,7 @@
"match": "\\b((0b[01_]+)|(0b[01_]+(u|u8|u16|u32|u64))|(0b[01_]+(i8|i16|i32|i64)))\\b"
},
{"name": "constant.numeric.float.source.rust",
- "match": "([0-9][0-9_]*(f|f32|f64))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f|f32|f64))|([0-9][0-9_]*\\.[0-9_]+)|([0-9][0-9_]*\\.[0-9_]+(f|f32|f64))|([0-9][0-9_]*\\.[0-9_]+%([eE][\\+-]=[0-9_]+))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+)(f|f32|f64))"
+ "match": "([0-9][0-9_]*(f|f32|f64))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f|f32|f64))|([0-9][0-9_]*\\.[0-9_]+)|([0-9][0-9_]*\\.[0-9_]+(f|f32|f64))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+)(f|f32|f64))"
},
{"name": "comment.line.documentation.source.rust",
"begin": "//!",
View
@@ -2,20 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>_comment</key>
- <array>
- <string>Created 2012 by Daniel Patterson &lt;dbp@riseup.net&gt;.</string>
- <string>Mit License.</string>
- <string>Last Updated: 2012.7.11.</string>
- <string>Derived from the Vim syntax file, maintained by</string>
- <string>Patrick Walton &lt;pcwalton@mozilla.com&gt;</string>
- <string>Ben Blum &lt;bblum@mozilla.com&gt;.</string>
- <string>With a little help from the TextMate rust mode by Webmuse | Tom Ellis.</string>
- <string>This syntax file supports current rust at the time of writing;</string>
- <string>it makes no attempt at backwards compatibility.</string>
- <string>This is intended to be a feature - if keywords no longer highlight,</string>
- <string>it means that the keyword has changed or will soon.</string>
- </array>
<key>fileTypes</key>
<array>
<string>rs</string>
@@ -59,9 +45,51 @@
</dict>
</array>
</dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.source.rust</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.function.source.rust</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>functions with types</string>
+ <key>match</key>
+ <string>\b(fn)\s+([a-zA-Z_]\w*)\s*(\()</string>
+ <key>name</key>
+ <string>meta.function.source.rust</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.source.rust</string>
+ </dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.function.source.rust</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>functions without types</string>
+ <key>match</key>
+ <string>\b(fn)\s+([a-zA-Z_]\w*)\s*(\()</string>
+ <key>name</key>
+ <string>meta.function.source.rust</string>
+ </dict>
<dict>
<key>match</key>
- <string>\b(again|as|break|check|claim|const|copy|do|drop|else|export|extern|fail|for|if|impl|import|in|let|log|loop|match|mod|module|move|mut|new|of|owned|priv|pub|pure|return|to|unchecked|use|while|with|mod|trait|class|struct|enum|type|fn)\b</string>
+ <string>\b(again|as|break|check|claim|const|copy|do|drop|else|export|extern|fail|for|if|impl|import|in|let|log|loop|match|mod|module|move|mut|new|of|owned|priv|pub|pure|return|to|unchecked|use|while|with|mod|trait|class|struct|enum|type)\b</string>
<key>name</key>
<string>keyword.source.rust</string>
</dict>
@@ -115,7 +143,7 @@
</dict>
<dict>
<key>match</key>
- <string>([0-9][0-9_]*(f|f32|f64))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f|f32|f64))|([0-9][0-9_]*\.[0-9_]+)|([0-9][0-9_]*\.[0-9_]+(f|f32|f64))|([0-9][0-9_]*\.[0-9_]+%([eE][\+-]=[0-9_]+))|([0-9][0-9_]*\.[0-9_]+%([eE][+-]=[0-9_]+)(f|f32|f64))</string>
+ <string>([0-9][0-9_]*(f|f32|f64))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f|f32|f64))|([0-9][0-9_]*\.[0-9_]+)|([0-9][0-9_]*\.[0-9_]+(f|f32|f64))|([0-9][0-9_]*\.[0-9_]+%([eE][+-]=[0-9_]+))|([0-9][0-9_]*\.[0-9_]+%([eE][+-]=[0-9_]+)(f|f32|f64))</string>
<key>name</key>
<string>constant.numeric.float.source.rust</string>
</dict>
@@ -0,0 +1,5 @@
+{ "name": "Rust Symbols",
+ "scope": "entity.name.function.source.rust",
+ "settings": {"showInSymbolList": 1},
+ "uuid": "d3270dd1-4ccd-428e-8dda-d3d20ee9fc7e"
+}
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>name</key>
+ <string>Rust Symbols</string>
+ <key>scope</key>
+ <string>entity.name.function.source.rust</string>
+ <key>settings</key>
+ <dict>
+ <key>showInSymbolList</key>
+ <integer>1</integer>
+ </dict>
+ <key>uuid</key>
+ <string>d3270dd1-4ccd-428e-8dda-d3d20ee9fc7e</string>
+</dict>
+</plist>

0 comments on commit 73d2d07

Please sign in to comment.