• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in

linter-csound

Lint Csound orchestras
  • #csound
  • #music
  • #sound
nwhetsell
0.5.13 949
1
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

Csound Linting in Atom

Actions apm

This Atom package adds syntax checking for Csound orchestras.

Including Files

The linter-csound preprocessor searches paths for files included using #include in this order:

  1. The paths returned by Project::getPaths. (This array usually contains one path that’s roughly equivalent to the current directory.)

  2. The path of the file being preprocessed.

  3. If there are files named .csound-include-directories in the paths returned by Project::getPaths, the paths (one per line) contained in each .csound-include-directories file. For example, if you create a file named .csound-include-directories in the root folder of your project, and this file contains

    /usr/local/csound/udos
    /usr/local/csound/more-udos
    

    then linter-csound will search /usr/local/csound/udos and /usr/local/csound/more-udos for included files.

  4. Paths you enter in linter-csound’s Settings.

Contributing

Open an issue, or fork this project and make a pull request.

linter-csound’s Orchestra Parser

To check the syntax of orchestras, linter-csound uses a preprocessor and parser generated using the GerHobbelt fork of Jison. The grammar used by the parser is based on this JavaScript grammar (which you can read about here) and this C grammar. To generate the preprocessor and parser on macOS, open a Terminal, cd to linter-csound/lib/csound-parser, and then run:

npm install https://github.com/GerHobbelt/jison/archive/0.6.1-215.tar.gz
node generate-parser.js

The linter-csound preprocessor and parser try to match Csound’s behavior, but linter-csound’s implementations are quite different. Here is how linter-csound’s Jison files correspond to Csound’s Flex/Bison files:

This Jison file Corresponds to this Flex/Bison file
preprocessor.jisonlex csound_pre.lex
orchestra.jisonlex csound_orc.lex
orchestra.jison csound_orc.y

Known Differences from Csound’s Preprocessor

Csound’s preprocessor:

  • permits 0-length parameter names in function-like macros. This orchestra prints hello, world:

    #define MACRO(arg') #$arg,$#
    prints "$MACRO(hello' world)\n"
    scoreline_i "e"

    The linter-csound preprocessor treats 0-length parameter names as errors.

  • permits duplicate parameter names in function-like macros. The linter-csound preprocessor treats duplicate parameter names as errors.

  • continues to compile after attempting to #include a directory. The linter-csound preprocessor treats this as an error.

Known Differences from Csound’s Parser

  • Csound’s parser silently ignores duplicate labels, while linter-csound gives a warning.

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by