Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional language: Forth #20

Closed
larsbrinkhoff opened this issue Nov 3, 2015 · 8 comments
Closed

Additional language: Forth #20

larsbrinkhoff opened this issue Nov 3, 2015 · 8 comments
Assignees

Comments

@larsbrinkhoff
Copy link
Contributor

File extensions: 4th, f, for, forth, fr, frt, fth, fs. These are supported by GitHub's Linguist.

Comments:

  • \ to end of line.
  • ( to ) on same line.
  • (* starts a multi-line comment ending with *).

Note that the token starting the comment must be surrounded by whitespace.

Links to sample code:
http://github.com/larsbrinkhoff/lbForth/blob/master/kernel.fth
http://github.com/search?q=language%3Aforth+dup+swap&type=Code

@larsbrinkhoff
Copy link
Contributor Author

Rare file extensions: 4, blk, f83, fb, fpm, ft, rx, scr, spf, txt, e4.

I guess you can ignore txt.

@AlDanial AlDanial self-assigned this Nov 4, 2015
AlDanial added a commit that referenced this issue Nov 4, 2015
@AlDanial
Copy link
Owner

AlDanial commented Nov 4, 2015

I added support for Forth with many (4th, e4, f83, fb, forth, fpm, fr, frt, ft, fth, rx) of the listed extensions with git commit 121cc5e.

These extensions conflict with Fortran: f, for
This extension conflicts with F#: fs
These extensions (like txt) map to non-code files I'm familiar with: scr, spf

cloc can work with extensions to map to multiple languages but then more work is needed to write a special function that can deduce which of the two or more languages a given file is. I might revisit that in the future. Or you could supply the function (see for inspiration cloc's existing subroutines matlab_or_objective_C(), pascal_or_puppet(), Perl_or_Prolog(), et cetera).

@AlDanial AlDanial closed this as completed Nov 4, 2015
@larsbrinkhoff
Copy link
Contributor Author

Thank you!

@larsbrinkhoff
Copy link
Contributor Author

scr is just Forth source code without line breaks. That's why they look strange.

AlDanial added a commit that referenced this issue Nov 15, 2015
better handling of --explain when language shares file extension
with other languages
@AlDanial
Copy link
Owner

The integration of your two routines is complete with git commit 88f71e7.

@larsbrinkhoff
Copy link
Contributor Author

Looks good!

@AlDanial
Copy link
Owner

hi Lars, if you have a moment could you respond to the remarks at #103 regarding the use of (* .. *) to denote Forth comments?

@larsbrinkhoff
Copy link
Contributor Author

Yep.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants