Closed sebcrozet closed 10 years ago
Thanks for this patch. We tried to compile and test it and found a couple of issues -
rust_number_entity
needs to be changed to -rust_number_entity =
'float' | 'f32' | 'f64' | 'uint' | 'int' | 'u8' | 'u16' | 'u32' | 'u64' | 'i8' | 'i16' | 'i32' |
'i64';
Does it compile for you without this change?
@amujumdar What .rs
things are there that aren't Rust? I'm not aware of anything else in widespread usage using it. (I mean, unless it's a significant problem, changing the detection to use file contents would probably be a bad idea.)
Then we get on to syntax changes:
rust_number_entity
, float
is no longer a type. For rust_keyword_entity
, the keywords available have changed; for example, continue
is now a keyword.r(#*)".*"\1
(e.g. r"foo"
, r#####"foo"#####
)./* /* nested comment */ still a comment */
). Not sure whether this supports it or not.Some of the other things in it may be out of date by now; hardcoding keywords and such doesn't seem a particularly productive thing to me; can we not just do without it? Does ohcount actually use anything beyond code, comment and blank?
I'm willing to update this if it needs updating.
The last time we checked, We had 410 repositories in ohloh with .rs files. the file count will be in thousands, this would easily lead to wrong data on ohloh and hence the popularity of the language. Thus it is very important to detect file by syntax and not by extension.
@pankajdoharey But how many of those are actually Rust? I would expect it to at the least be a considerable fraction of them. Anyway, I really need a list of things that I can look at before filetype detection can be meaningfully assessed. At present I have nothing to work on. Could you get me that data?
I am not sure how many of them are rust or not but surely i can give you the list of the projects, making use of .rs files have a look at the follwoing gist :+1:
@pankajdoharey Sorry, I got distracted with other things before I finished this.
I went through all the GitHub ones and a few of the other ones in detail and classified some that were easy; these are the results I've got:
keccak.rs
)These should be using .res
, which is the standard extension for such things.
rayd/bin/initgui.rs
, project-local scripting languageRouteSharp/PathFinder/netfile.rs
, project-local network specification languagebrowserFig1.rs
, binary datashadowCast.rs
, some sort of shader INI filenew.rs
, binary dataI'm not sure how these are created, but they get put as siblings to .class
files and contain one class name per line. Being the compiled output, they should certainly never have been in version control. (Thus I am quite willing to ignore them.)
People often give something an extension which has no inherent meaning; these appear to be such cases.
.rs
)Now we get to the more important ones:
(Probably not using .rs
files any more.)
As indicated, I haven't looked at everything.
I believe that RenderScript is the only one which needs disambiguation. There are two convenient things that it can be disambiguated on:
#pragma version(1)
(1
is the only valid version at present)#pragma rs java_package_name(com.example.app)
(for some value of com.example.app
)I suggest disambiguating on the string #pragma version
, treating files with it as unknown (until someone implements RenderScript in Ohcount, which I'm not going to do as I don't care about it) and files without it as Rust.
I shall now implement this in #30.
Rust is a programming language developed by Mozilla: www.rust-lang.org.