cs2lint

CubeScript linter for Cube2 engine
git clone git://deadbeef.fr/cs2lint.git
Log | Files | Refs | README | LICENSE

commit c239a35382b1cb436a35c472ce8d8d43efd91eaa
Author: Morel Bérenger <berengermorel76@gmail.com>
Date:   Sun, 19 Jul 2020 00:31:10 +0200

initial commit

Diffstat:
A.gitignore | 1+
ALICENSE | 7+++++++
AREADME | 3+++
Abuild.sh | 5+++++
Acubescript.atg | 35+++++++++++++++++++++++++++++++++++
5 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +build diff --git a/LICENSE b/LICENSE @@ -0,0 +1,7 @@ +Copyright © 2020-07-19, Morel Bérenger and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README b/README @@ -0,0 +1,3 @@ +This repo aims at creating a tool that checks CubeScript2 syntax, a so called "linter". + +Needs coco-cpp to build. diff --git a/build.sh b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +test -e coco_build && rm -r coco_build +mkdir coco_build +cococpp -frames /usr/share/coco-cpp/ -o coco_build cubescript.atg diff --git a/cubescript.atg b/cubescript.atg @@ -0,0 +1,35 @@ +COMPILER CubeScript2 + +CHARACTERS + +cr = '\r'. +lf = '\n'. +nonwhite = '\u0020'..'\u007e'. +eol = ';' + cr + lf. +special = "(){}[]". + +strch = ANY - cr - lf - '"'. +wordch = nonwhite - '"' - special - eol - ' '. + +TOKENS + +string = '"' { strch | '^' nonwhite } ['"']. +word = ( wordch { wordch } ). +statement_end = eol. + +COMMENTS FROM "//" TO cr +COMMENTS FROM "//" TO lf +/* not currently supported by engine */ +COMMENTS FROM "/*" TO "*/" + +IGNORE '\t' + ' ' + +PRODUCTIONS + +CubeScript2 = { statement }. +statement = { word | string | squar_block | curly_block | round_block } statement_end . +squar_block = '[' { statement } ']' . +curly_block = '{' { statement } '}' . +round_block = '(' { statement } ')' . + +END CubeScript2 .