RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1k stars 175 forks source link

Parser too strict (and maybe buggy) #502

Closed Speciesx closed 8 years ago

Speciesx commented 8 years ago

http://www.rigsofrods.com/repository/view/5282 http://www.rigsofrods.com/repository/view/4886

ror_2015_12_23_11_31_32_310 ror_2015_12_23_11_32_00_166 ror_2015_12_23_11_33_21_689 rorlog.txt

ohlidalp commented 8 years ago

Many many syntax flaws in the truckfile.... And super-duper strict parser...

23:17:51:  == Parsing vehicle file: volvo-EC140C.truck
#FF3300 ERROR #FFFFFF (Section contacters)
    Line (1966): 205,
    Message: Invalid line, ignoring...

The trailing comma is invalid. But old parser would just ignore it. EDIT : Fixed in upstream: https://github.com/RigsOfRods/rigs-of-rods/commit/f3d33b1c4fe1461716adf14869618f5ebeef457b

23:18:11:  == Parsing vehicle file: volvofmx-6x6withcrane.truck
#FF3300 ERROR #FFFFFF (Section torquecurve)
    Line (46):  NOTGGLE
    Message: Invalid mode keyword, ignoring whole line...

NOT!o!GGLE... I'm not sure what old parser would do here... I guess it would just fall back to defaults. EDIT: Right, it would just ignore the option: https://github.com/RigsOfRods/rigs-of-rods/blob/bd680916356ea033716c96582305a37347644b9a/source/main/physics/input_output/SerializedRig.cpp#L704-L707 EDIT : Fixed in upstream (TractionControl): https://github.com/RigsOfRods/rigs-of-rods/commit/6b8b922515e824abf08bf7f5135cc0a602486a4e

#FF3300 ERROR #FFFFFF (Section rotators_2)
    Line (1867): 222,217,223,225,226,224,218,220,
                 221,219,0.1,9,10,1000000,0.1   turning-grapple
    Message: Invalid line, ignoring...

Hmm, probably the parser is too strict on commas versus spaces here.. EDIT: Right, the parser requires a comma before the 'description'. Will loosen it up... EDIT : Fixed in upstream: https://github.com/RigsOfRods/rigs-of-rods/commit/e6b80c593fd3e01f417a42982cec29d12df41e6b

#FFFF00 WARNING #FFFFFF (Section ties)
    Line (1967): 222,3,1,1,1,n,0,1
    Message: Ignoring invalid option: ,

A bug... a comma should always be treated like a delimiter, never as an option Fixed, pullrequest: https://github.com/RigsOfRods/rigs-of-rods/pull/674

#FF3300 ERROR #FFFFFF (Section hooks)
    Line (1983): selflock
    Message: Invalid option of 'hooks', ignoring...

Ignoring what? It's an error, so probably whole line. I doubt old parser would be that strict EDIT: Ulteq pointed me out to the issue...https://github.com/RigsOfRods/rigs-of-rods/issues/502#issuecomment-177240049 Fixed, pullrequest: https://github.com/RigsOfRods/rigs-of-rods/pull/674

#FF3300 ERROR #FFFFFF (Section flares2)
    Line (2010): 5,4,1,-0.61,0.3,0.0,b -1,0,-1, default
    Message: Invalid line, ignoring...

Dumb super-strict parser (comma vs. space separators), this is already reported elsewhere. EDIT : Fixed in upstream: https://github.com/RigsOfRods/rigs-of-rods/commit/3c85ad2cc3f0e4204463227c6519fe6a46b1993c

#FF3300 ERROR #FFFFFF (Section props)
    Line (2043): 137,135,141, ,0,0,0 ,90,0,0 ,vlvfmx48cabinS.mesh
    Message: Invalid line, ignoring...

OK, this is an actual truckfile error: {141, ,0} But IIRC old parser handled this fine. Fixed, pullrequest: https://github.com/RigsOfRods/rigs-of-rods/pull/674

#FF3300 ERROR #FFFFFF (Section flexbodies)
    Line (2199): forset256,255,254,253
    Message: Invalid line, ignoring...

Truckfile error again, no space between forset and the number. But I guess the old parser would just ignore the '256' and happily process the rest. Needs investigation. EDIT: Turns out old parser accepted all the numbers fine Fixed, pullrequest: https://github.com/RigsOfRods/rigs-of-rods/pull/674

Speciesx commented 8 years ago

@only-a-ptr http://www.rigsofrods.com/threads/112719-volvo-EC140C This is the correct excavator.

WARNING (Section nodes) Line (465): 334, 3.031496, 0.424640, 2.897959, c l 6000 Message: Failed to parse using safe method, falling back to classic method.

WARNING (Section nodes) Line (465): 334, 3.031496, 0.424640, 2.897959, c l 6000 Message: Node has load-weight-override value specified, but option 'l' is not present. Ignoring value...

ohlidalp commented 8 years ago

@Speciesx Flawed syntax, it wouldn't work correctly in the old parser either

Line (465): 334, 3.031496, 0.424640, 2.897959, c l 6000

There's a space (valid separator) between c and l, which means syntax check fails and parser falls back to "classic method (0.x3 compatible)":

ohlidalp commented 8 years ago

Note to self:

EDIT: fixed in upstream: https://github.com/RigsOfRods/rigs-of-rods/commit/f91373fcf97a72a1b985f9ca01c28f3494eaa5bb

ohlidalp commented 8 years ago

Note to self:

Hooks += E_CAPTURE("selflock|self-lock|self_lock")

Old: https://github.com/only-a-ptr/ror-legacy-svn-trunk/blob/master/source/main/physics/input_output/SerializedRig.cpp#L1735 New: https://github.com/RigsOfRods/rigs-of-rods/blob/master/source/rig_file_input_output/RigDef_Regexes.h#L1680

Fixed, pullrequest: https://github.com/RigsOfRods/rigs-of-rods/pull/674