zargony / atom-language-rust

Rust language support in Atom - LOOKING FOR MAINTAINER, see #144
MIT License
116 stars 33 forks source link

'as' is mentioned twice #107

Closed Amomum closed 7 years ago

Amomum commented 7 years ago

Not sure if it's a problem at all but still. 'as' is mentioned twice - as a keyword and as an operator:

https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson:

` { 'comment': 'Keyword' 'name': 'keyword.other.rust' 'match': '\b(crate|extern|mod|let|proc|ref|use|super|as|move)\b' <---- here } { 'include': '#unsafe' } { 'include': '#sigils' } { 'include': '#self' } { 'include': '#mut' } { 'include': '#box' } { 'include': '#lifetime' } { 'include': '#ref_lifetime' } { 'include': '#const' } { 'include': '#pub' }

{ 'comment': 'Miscellaneous operator' 'name': 'keyword.operator.misc.rust' 'match': '(=>|::|\bas\b)' <---- and here }`

As far as I could understand 'as' is a reserved keyword (i.e. you can't declare a variable with that name) and it's sort of an operator, although operators are usually applied to values and not types.

Anyway, I suppose that causes highlighting to mistake slightly, since the second appearence doesn't "count".

zargony commented 7 years ago

Thanks for reporting!

I'd say that we should mark as as an operator (since it seems more specific than being a keyword). Sublime grammar seems to recognize it as an operator as well ;)