Skip to content

Commit

Permalink
Merge pull request #831 from jackos/jackos/add-mojo
Browse files Browse the repository at this point in the history
Add support for Mojo, #831
  • Loading branch information
AlDanial authored May 26, 2024
2 parents 333d6bf + ae61d65 commit 61d4fc9
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,8 @@ Maven (pom, pom.xml)
Meson (meson.build)
Metal (metal)
Modula3 (i3, ig, m3, mg)
Mojo (mojom)
Mojom (mojom)
Mojo (mojo, 🔥)
MSBuild script (btproj, csproj, msbuild, vcproj, wdproj, wixproj)
MUMPS (mps, m)
Mustache (mustache)
Expand Down
3 changes: 2 additions & 1 deletion Unix/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ https://github.com/mwiley
https://github.com/michalmuskala
https://github.com/Inventitech
https://github.com/zhangzqs
https://github.com/drkameleon
https://github.com/drkameleon
https://github.com/jackos
17 changes: 14 additions & 3 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8625,7 +8625,9 @@ sub set_constants { # {{{1
'mc' => 'Windows Message File' ,
'met' => 'Teamcenter met' ,
'mg' => 'Modula3' ,
'mojom' => 'Mojo' ,
'mojom' => 'Mojom' ,
'mojo' => 'Mojo' ,
'🔥' => 'Mojo' ,
'meson.build' => 'Meson' ,
'metal' => 'Metal' ,
'mk' => 'make' ,
Expand Down Expand Up @@ -10076,7 +10078,15 @@ sub set_constants { # {{{1
'Modula3' => [ [ 'call_regexp_common' , 'Pascal' ], ],
# Modula 3 comments are (* ... *) so applying the Pascal filter
# which also treats { ... } as a comment is not really correct.
'Mojo' => [ [ 'call_regexp_common' , 'C++' ], ],
'Mojom' => [ [ 'call_regexp_common' , 'C++' ], ],
'Mojo' => [
[ 'remove_matches' , '/\*' ],
[ 'remove_matches' , '\*/' ],
[ 'remove_matches' , '^\s*#' ],
[ 'docstring_to_C' ],
[ 'call_regexp_common' , 'C' ],
[ 'remove_inline' , '#.*$' ],
],
'Nemerle' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
Expand Down Expand Up @@ -11457,7 +11467,8 @@ sub set_constants { # {{{1
'Octave' => 4.00,
'ML' => 3.00,
'Modula3' => 2.00,
'Mojo' => 2.00,
'Mojom' => 2.00,
'Mojo' => 4.20,
'PHP' => 3.50,
'Jupyter Notebook' => 4.20,
'Python' => 4.20,
Expand Down
7 changes: 6 additions & 1 deletion Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,15 @@ my @Tests = (
'args' => '../tests/inputs/SimpleODE.mo',
},
{
'name' => 'Mojo',
'name' => 'Mojom',
'ref' => '../tests/outputs/Mojo.mojom.yaml',
'args' => '../tests/inputs/Mojo.mojom',
},
{
'name' => 'Mojo',
'ref' => '../tests/outputs/hi.mojo.yaml',
'args' => '../tests/inputs/hi.mojo',
},
{
'name' => 'Mumps',
'ref' => '../tests/outputs/Mumps.mps.yaml',
Expand Down
18 changes: 15 additions & 3 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8640,7 +8640,9 @@ sub set_constants { # {{{1
'mc' => 'Windows Message File' ,
'met' => 'Teamcenter met' ,
'mg' => 'Modula3' ,
'mojom' => 'Mojo' ,
'mojom' => 'Mojom' ,
'mojo' => 'Mojo' ,
'🔥' => 'Mojo' ,
'meson.build' => 'Meson' ,
'metal' => 'Metal' ,
'mk' => 'make' ,
Expand Down Expand Up @@ -10091,7 +10093,16 @@ sub set_constants { # {{{1
'Modula3' => [ [ 'call_regexp_common' , 'Pascal' ], ],
# Modula 3 comments are (* ... *) so applying the Pascal filter
# which also treats { ... } as a comment is not really correct.
'Mojo' => [ [ 'call_regexp_common' , 'C++' ], ],
'Mojom' => [ [ 'call_regexp_common' , 'C++' ], ],
'Mojo' => [
[ 'remove_matches' , '/\*' ],
[ 'remove_matches' , '\*/' ],
[ 'remove_matches' , '^\s*#' ],
[ 'docstring_to_C' ],
[ 'call_regexp_common' , 'C' ],
[ 'remove_inline' , '#.*$' ],
],

'Nemerle' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
Expand Down Expand Up @@ -11472,7 +11483,8 @@ sub set_constants { # {{{1
'Octave' => 4.00,
'ML' => 3.00,
'Modula3' => 2.00,
'Mojo' => 2.00,
'Mojom' => 2.00,
'Mojo' => 4.20,
'PHP' => 3.50,
'Jupyter Notebook' => 4.20,
'Python' => 4.20,
Expand Down
18 changes: 18 additions & 0 deletions tests/inputs/hi.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#mojo
# Works with Mojo.

# pound comment

def main():
from time import now
print("Hello, the monotonic time is:", now()) # inline comment

"""
Docstring,
also counted as comment.
"""

'''
Single
Quoted
Docstring'''
21 changes: 21 additions & 0 deletions tests/outputs/hi.mojo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 2.01
elapsed_seconds : 0.0048980712890625
n_files : 1
n_lines : 12
files_per_second : 204.16199376947
lines_per_second : 2449.94392523364
report_file : hi.mojo.yaml
Mojo :
nFiles: 1
blank: 4
comment: 11
code: 3
SUM:
blank: 4
comment: 11
code: 2
nFiles: 1

0 comments on commit 61d4fc9

Please sign in to comment.