It can check .ssc, .stc, .dsc, .cel, .cms, ASCII .cmod, .xyz and .xyzv files for their syntax (but not the values of each parameter). This can be useful if you have an ssc file which is very long (e.g. a long timeline with many parameters each) and you are unsure if you have closed all opened braces.
To use it:
Open a command line, run the file from there and pass the name to the file as an argument, like this:
Code: Select all
celcheck_x.y.exe myfile.ssc
Where x.y is the actual version (1.0, 1.1, etc.).
Note: the script allows you to put ssc, stc, dsc objects, cel scripts and .cms models together into one file, so if you have a large addon with two or more types of objects and scripts, you don't have to check each file separately but all in once. Cmod model must be separated into own files (one model per file) whose file names end with ".cmod"! Also, cmod models must be in ASCII encoding mode (you can check this by opening the model in a text editor and looking at the first few bytes: if it starts with #celmodel__ascii, it is the correct format, if it's #celmodel_binary followed by a bunch of unreadable characters, it's the wrong format (notice the double underscores in the ascii header and the single underscore in the binary header (to make both headers 16 bytes long))!
This script doesn't check the names and values of the parameters (for compatibility reasons, one Celestia version has other/new paramaters than an older one).
Examples for defintions celcheck will mark as valid:
Code: Select all
"My object" "Sol/Parent" {
Class "moon"
}
Modify "My other object" "Sol/Parent" {}
"" "" {}
# This definition has wrong values but celcheck doesn't care about that:
"My fourth object" "Sol/Parent" {
Class 123
Radius "invalid radius, but valid file"
Texture [1 2 3]
EllipticalOrbit true
SomeUnknownParameter [1 [1 2] {Key "value"} true 1 3 false]
}
Invalid definitions:
Code: Select all
# [] instead of {}
"My object" "Sol/Parent" [
Class "moon"
]
# Forget to specify the parent object
Modify "My other object" {}
# Forget the {}
"" ""
# The 'UniformRotation' parameter doesn't have a value +
# there is an unclosed { in the SomeUnknownParameter (or if it is closed by the end }, the main body isn't closed)
"My fourth object" "Sol/Parent" {
Class 123
Radius "invalid radius, but valid file"
UniformRotation
Texture [1 2 3]
EllipticalOrbit true
SomeUnknownParameter [1 [1 2] {Key "value" true 1 3 false]
}
Note: there must be at least one object definition in the file to be valid.
The script has been written in Python and uses the Lark parser.
How the script works internally:
1. Try to read input file
If everything runs well:
_2. Build the parser
_3. Parse the file
_If there are no errors:
__4. Tell the user that the file is valid
_If there are errors:
__4. Print the errors
If none is specified or it could not be read:
_2. print an appropriate message
5. Exit
Files for download:
celcheck_x.y.exe - binary program
source_code_x.y.zip - contains "celcheck.py" (for anyone who wants to modify/fix bugs/extend the script, but you have to credit me if you publish that modifed version), also contains a "grammar.lark" file for versions 1.0 and 1.1
Changelog:
If you need an older version than the latest one, comment below or PM me.
1.1: Added support for .cel scripts!
1.2: Added support for .cmod (only ASCII) and .cms models! A cmod model's name MUST end with ".cmod" to be recognized by celcheck! A file with any other file extension must countain .cel, .ssc, .stc, .dsc or .cms data! Builds are now in --onedir mode and not in --onefile (PyInstaller) anymore! The .cms mode has been tested with Celestia 1.7.0 srgb's models/asteroid.cms model. There are no grammer files in the source_code_x.y.zip files anymore. Open the .py script to find the grammar data.
The syntax definition of .cmod files comes from the Wikibooks page about CMOD files. I am not responsible for any errors in the docs (but I have tested celcheck on a model). Additionally, I have added the pointsize option to <vertex_semantic> (for sprite models).
1.3: Strings can now be multi-line in all files currently supported (except .cmod files), like multi-line object name definitions:
Code: Select all
"my object:other name:third name:
fourth name" "Parent" { <parameters> }
1.4: Added support for .xyz and .xyzv files: these files must have their corresponding file extension (e.g. a file with the ending .abc won't get parsed as xyz(v) but as ssc/dsc/stc).