MCPcopy Create free account
hub / github.com/WheretIB/nullc / InitGrammar

Method InitGrammar

Colorer.cpp:371–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369 {
370 public:
371 void InitGrammar()
372 {
373 symb = graphP - alnumP - chP(')') - chP('@');
374 symb2 = graphP - alphaP;
375 typeName = idP - strP("return");
376
377 arrayDef =
378 (
379 chP('[')[ColorText] >>
380 (term4_9 | epsP) >>
381 (chP(']')[ColorText] | epsP[LogError("ERROR: closing ']' not found in array definition")]) >>
382 !arrayDef
383 );
384 typePostExpr =
385 !(
386 chP('<')[ColorText] >>
387 (typeExpr | (chP('@')[ColorText] >> idP[ColorRWord])) >>
388 *(chP(',')[ColorText] >> (typeExpr | (chP('@')[ColorText] >> idP[ColorRWord]))) >>
389 chP('>')[ColorText]
390 ) >>
391 *(
392 (strWP("ref")[ColorRWord] >> !(chP('(')[ColorText] >> !(typeExpr | idP[ColorRWord]) >> *(chP(',')[ColorText] >> (typeExpr | idP[ColorRWord])) >> chP(')')[ColorText])) |
393 arrayDef
394 );
395 typeofPostExpr =
396 chP('.')[ColorText] >>
397 (
398 (
399 strP("argument")[ColorRWord] >>
400 ((chP('.')[ColorText] >> (strP("first")[ColorRWord] | strP("last")[ColorRWord] | strP("size")[ColorRWord])) | (chP('[')[ColorText] >> intP[ColorReal] >> chP(']')[ColorText]))
401 ) |
402 strP("return")[ColorRWord] |
403 strP("target")[ColorRWord] |
404 strP("isArray")[ColorRWord] |
405 strP("isFunction")[ColorRWord] |
406 strP("isReference")[ColorRWord] |
407 strP("arraySize")[ColorRWord] |
408 typenameP(typeName)[ColorRWord] |
409 idP[ColorVar]
410 );
411 typeExpr =
412 (
413 (strWP("auto")[ColorRWord] | (typenameP(typeName)[ColorRWord] >> *typeofPostExpr) | ((chP('@')[ColorText] >> idP[ColorRWord]))) |
414 (
415 strP("typeof")[ColorRWord] >>
416 (chP('(')[ColorText] | epsP[LogError("ERROR: '(' not found after 'typeof'")]) >>
417 (term5 | epsP[LogError("ERROR: expression not found in 'typeof' statement")]) >>
418 (chP(')')[ColorText] | epsP[LogError("ERROR: ')' not found after 'typeof' statement")]) >>
419 *typeofPostExpr
420 )
421 ) >>
422 typePostExpr;
423
424 classbody =
425 (chP('{') | epsP[LogError("ERROR: '{' not found after class name")])[ColorText] >>
426 *(
427 (strWP("const")[ColorRWord] >> typeExpr >> idP[ColorVarDef] >> chP('=')[ColorText] >> term4_9 >> *(chP(',')[ColorText] >> idP[ColorVarDef] >> !(chP('=')[ColorText] >> term4_9)) >> chP(';')[ColorText]) |
428 typeDef |

Callers 1

ColorerMethod · 0.80

Calls 6

chPFunction · 0.85
strPFunction · 0.85
LogErrorClass · 0.85
strWPFunction · 0.85
typenamePFunction · 0.85
quotedStrPFunction · 0.85

Tested by

no test coverage detected