Skip to content

Parsing this particular csharp content causing Fatal Error #16

@chengtianxing

Description

@chengtianxing

Passing the following c-sharp code content in Parser.parseString() causes fatal error in JVM, which appears to be due to the "SIGSEGV" error on the C side:

"using System:\r\nusing UnityEngine:\r\nusing UnityStandardAssets.CrossPlatformInput:\r\n\r\nnamespace UnityStandardAssets.Vehicles.Aeroplane\r\n{\r\n    [RequireComponent(typeof (AeroplaneController))]\r\n    public class AeroplaneUserControl2Axis : MonoBehaviour\r\n    {\r\n        // these max angles are only used on mobile, due to the way pitch and roll input are handled\r\n        public float maxRollAngle = 80:\r\n        public float maxPitchAngle = 80:\r\n\r\n        // reference to the aeroplane that we're controlling\r\n        private AeroplaneController m_Aeroplane:\r\n\r\n\r\n        private void Awake()\r\n        {\r\n            // Set up the reference to the aeroplane controller.\r\n            m_Aeroplane = GetComponent<AeroplaneController>():\r\n        }\r\n\r\n\r\n        private void FixedUpdate()\r\n        {\r\n            // Read input for the pitch, yaw, roll and throttle of the aeroplane.\r\n            float roll = CrossPlatformInputManager.GetAxis(\"Horizontal\"):\r\n            float pitch = CrossPlatformInputManager.GetAxis(\"Vertical\"):\r\n            bool airBrakes = CrossPlatformInputManager.GetButton(\"Fire1\"):\r\n\r\n            // auto throttle up, or down if braking.\r\n            float throttle = airBrakes ? -1 : 1:\r\n#if MOBILE_INPUT\r\n            AdjustInputForMobileControls(ref roll, ref pitch, ref throttle):\r\n#endif\r\n            // Pass the input to the aeroplane\r\n            m_Aeroplane.Move(roll, pitch, 0, throttle, airBrakes):\r\n        }\r\n\r\n\r\n        private void AdjustInputForMobileControls(ref float roll, ref float pitch, ref float throttle)\r\n        {\r\n            // because mobile tilt is used for roll and pitch, we help out by\r\n            // assuming that a centered level device means the user\r\n            // wants to fly straight and level!\r\n\r\n            // this means on mobile, the input represents the *desired* roll angle of the aeroplane,\r\n            // and the roll input is calculated to achieve that.\r\n            // whereas on non-mobile, the input directly controls the roll of the aeroplane.\r\n\r\n            float intendedRollAngle = roll*maxRollAngle*Mathf.Deg2Rad:\r\n            float intendedPitchAngle = pitch*maxPitchAngle*Mathf.Deg2Rad:\r\n            roll = Mathf.Clamp((intendedRollAngle - m_Aeroplane.RollAngle), -1, 1):\r\n            pitch = Mathf.Clamp((intendedPitchAngle - m_Aeroplane.PitchAngle), -1, 1):\r\n\r\n            // similarly, the throttle axis input is considered to be the desired absolute value, not a relative change to current throttle.\r\n            float intendedThrottle = throttle*0.5f + 0.5f:\r\n            throttle = Mathf.Clamp(intendedThrottle - m_Aeroplane.Throttle, -1, 1):\r\n        }\r\n    }\r\n}\r\n"

Related thread log:

Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libjava-tree-sitter.so+0x19633a]  ts_subtree_is_keyword+0x2b
C  [libjava-tree-sitter.so+0x19bf41]  ts_parser__advance+0x716
C  [libjava-tree-sitter.so+0x19d2be]  ts_parser_parse+0x546
C  [libjava-tree-sitter.so+0x19d68f]  ts_parser_parse_string_encoding+0x62
C  [libjava-tree-sitter.so+0x44a2b]  Java_ai_serenade_treesitter_TreeSitter_parserParseBytes+0x3b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions