add parser
This commit is contained in:
parent
b5afc3d80a
commit
2157c19de7
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,10 @@
|
|||||||
## my ban
|
## my ban
|
||||||
out/
|
out/
|
||||||
temp/
|
temp/
|
||||||
|
NlpParser/*
|
||||||
|
!NlpParser/Nlp.g4
|
||||||
|
!NlpParser/testbench.txt
|
||||||
|
!NlpParser/compile.bat
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
28
NlpParser/Nlp.g4
Normal file
28
NlpParser/Nlp.g4
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
grammar Nlp;
|
||||||
|
|
||||||
|
nlp_document: LANG_HEADER (section)* ;
|
||||||
|
|
||||||
|
section: SECTION_HEAD (sub_section | entry)* ;
|
||||||
|
|
||||||
|
sub_section: SUB_SECTION_HEAD (entry)* ;
|
||||||
|
|
||||||
|
entry: ENTRY_STRING # entry_string_t
|
||||||
|
| ENTRY_STRING (LINE_CONCAT ENTRY_STRING)+ # entry_concated_string_t
|
||||||
|
| ENTRY_INTEGER # entry_integer_t
|
||||||
|
;
|
||||||
|
|
||||||
|
LANG_HEADER: 'Language:' [a-zA-Z]+ ;
|
||||||
|
|
||||||
|
SECTION_HEAD: '[' NAME_SECTION ']' ;
|
||||||
|
SUB_SECTION_HEAD: '<' NAME_SECTION '>' ;
|
||||||
|
fragment NAME_SECTION: [ a-zA-Z0-9]+ ; // section name are consisted of space, char and number
|
||||||
|
|
||||||
|
ENTRY_STRING: '"' (STRING_ESC|.)*? '"' ;
|
||||||
|
fragment STRING_ESC: '\\"' | '\\\\' ;
|
||||||
|
|
||||||
|
ENTRY_INTEGER: [1-9][0-9]+ ;
|
||||||
|
|
||||||
|
SPLITTOR: [ ,;\r\n]+ -> skip; // ignore all splittor and space
|
||||||
|
LINE_CONCAT: '\\' ;
|
||||||
|
LINE_COMMENT: '//' ~[\r\n]* -> skip ; // consume all non-line-breaker. because we need line breaker.
|
||||||
|
BLOCK_COMMENT: '/*' .*? '*/' -> skip ;
|
3
NlpParser/compile.bat
Normal file
3
NlpParser/compile.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
antlr4 Nlp.g4
|
||||||
|
javac Nlp*.java
|
||||||
|
grun Nlp nlp_document < testbench.txt
|
71
NlpParser/testbench.txt
Normal file
71
NlpParser/testbench.txt
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
Language:English
|
||||||
|
|
||||||
|
/*
|
||||||
|
----===[[[[ Virtools Language Pack File ]]]]===----
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
First line must contain the string 'Language:' followed by the language name.
|
||||||
|
The file may be seen as sections, each section name is enclosed in brackets ([,])
|
||||||
|
Sections can have sub-sections, with names enclosed in brackets (<,>)
|
||||||
|
For every section or sub-section, you can have as many entries as you want,
|
||||||
|
which can be: - strings (optionaly enclosed in quotes)
|
||||||
|
- numbers
|
||||||
|
Separators for entries are ',',';' or LF (line feed)
|
||||||
|
Entries belong to the last section or sub-section specified, until
|
||||||
|
a new section is reached. The first entry of the section has an index of 0,
|
||||||
|
the next one, an index of 1, and so on.
|
||||||
|
Comments can be added using the standard ANSI C++ scheme.
|
||||||
|
Also, dont remove %s,%d and %f tags, those will be replaced at runtime by strings or numbers.
|
||||||
|
A string can take multiple lines, adding \ at the end of the line means that the entry
|
||||||
|
continues on the next line.
|
||||||
|
|
||||||
|
NOTE FOR TRANSLATORS: DO NOT CHANGE ENTRIES ORDER IN THIS FILE!!!
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Version]
|
||||||
|
"Virtools Dev","Virtools Crea"
|
||||||
|
"Virtools Dev Evaluation","Virtools Crea Evaluation"
|
||||||
|
"Virtools Dev Education","Virtools Crea Education"
|
||||||
|
|
||||||
|
|
||||||
|
[Profiler]
|
||||||
|
"Profiler"
|
||||||
|
|
||||||
|
"Database","Framerate","Objects Drawn","Faces Drawn","Lines Drawn"
|
||||||
|
"Behavior Code Execution Details...","Collisions Management","Parametric Operations",
|
||||||
|
"IK","Floors Management","Other Code"
|
||||||
|
|
||||||
|
[Common]
|
||||||
|
|
||||||
|
"MultiSelection"
|
||||||
|
|
||||||
|
// -- DONT CHANGE THIS
|
||||||
|
|
||||||
|
<Registry>
|
||||||
|
"Software\\Virtools\\Global","Usage Count"
|
||||||
|
|
||||||
|
<Timebomb>
|
||||||
|
"Key1","Key2","Key3","SYSINFO.SysInfo32\\CLSID","\\csrsrv32.dll"
|
||||||
|
|
||||||
|
// -- ENDOF DONT CHANGE
|
||||||
|
|
||||||
|
<Timebomb Messages>
|
||||||
|
"Your license has expired.\n\nYou must either stop evaluating Virtools or\nextend it by clicking the 'Extend' button and following the instructions.\n\nAlso, check out our web resources for more information:"
|
||||||
|
"- Main Web Site","- Virtools mailing list, additional resources, discussions and more."
|
||||||
|
"Customer Key:","Check Key:"
|
||||||
|
"HOWTO:\n\t- A new customer key will be generated.\n\t- Send it by e-mail to our support service at: support@Virtools.com\n"\
|
||||||
|
"\t You will receive back a valid check key according to your customer key.\n\t- Copy/Paste the key into corresponding field above.\n"\
|
||||||
|
"\t- Your license will be extended to as many days as specified in your agreement.\n\n"\
|
||||||
|
"WARNING: Once generated, the customer key is valid for 5 days only."
|
||||||
|
|
||||||
|
|
||||||
|
[3D Layout]
|
||||||
|
"3D Layout"
|
||||||
|
|
||||||
|
<Names>
|
||||||
|
"New 3D Frame","New 2D Frame","New Camera","New Light","New Curve","New Grid","New Material","New Texture","New Portal"
|
||||||
|
|
||||||
|
<Actions>
|
||||||
|
"--- Out of range ---"
|
||||||
|
"%s '%s' created." // on creation (ie. TargetLight 'light0000' created.)
|
Loading…
Reference in New Issue
Block a user