gmat-script 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. gmat_script-0.1.0/.gitignore +47 -0
  2. gmat_script-0.1.0/CHANGELOG.md +32 -0
  3. gmat_script-0.1.0/CITATION.cff +24 -0
  4. gmat_script-0.1.0/LICENSE +21 -0
  5. gmat_script-0.1.0/PKG-INFO +115 -0
  6. gmat_script-0.1.0/README.md +82 -0
  7. gmat_script-0.1.0/docs/api.md +11 -0
  8. gmat_script-0.1.0/docs/cli.md +115 -0
  9. gmat_script-0.1.0/docs/design/decisions.md +639 -0
  10. gmat_script-0.1.0/docs/errors.md +91 -0
  11. gmat_script-0.1.0/docs/getting-started.md +100 -0
  12. gmat_script-0.1.0/docs/grammar-surface.md +162 -0
  13. gmat_script-0.1.0/docs/index.md +53 -0
  14. gmat_script-0.1.0/hatch_build.py +85 -0
  15. gmat_script-0.1.0/mkdocs.yml +80 -0
  16. gmat_script-0.1.0/pyproject.toml +165 -0
  17. gmat_script-0.1.0/src/gmat_script/__init__.py +13 -0
  18. gmat_script-0.1.0/src/gmat_script/_grammar/__init__.py +14 -0
  19. gmat_script-0.1.0/src/gmat_script/_grammar/_binding.pyi +7 -0
  20. gmat_script-0.1.0/src/gmat_script/cli.py +177 -0
  21. gmat_script-0.1.0/src/gmat_script/parser.py +199 -0
  22. gmat_script-0.1.0/src/gmat_script/py.typed +0 -0
  23. gmat_script-0.1.0/tests/check_corpus.py +100 -0
  24. gmat_script-0.1.0/tests/data/corpus/config_section.script +53 -0
  25. gmat_script-0.1.0/tests/data/corpus/config_section_crlf.script +5 -0
  26. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/LICENSE +176 -0
  27. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/PROVENANCE.md +54 -0
  28. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_AnalyticMassProperties.script +206 -0
  29. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Attitude_Inertial.script +104 -0
  30. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Attitude_ModifiedRodriguesParameters.script +104 -0
  31. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Attitude_NadirPointing.script +132 -0
  32. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Attitude_Spinner.script +104 -0
  33. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Attitude_VNB.script +86 -0
  34. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Basic3DModel.script +83 -0
  35. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_CCSDSAEMAttitude.script +51 -0
  36. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_CSSISpaceWeatherFile.script +67 -0
  37. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_CommandEcho_GEOTransfer.script +194 -0
  38. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ConstellationScript.script +700 -0
  39. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Contact_Location_Station_Mask.script +161 -0
  40. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ControlFlow.script +112 -0
  41. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_CustomSegmentColors.script +107 -0
  42. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_DoubleLunarSwingby.script +350 -0
  43. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_DynamicDisplay_QuaternionPropagation.script +384 -0
  44. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_EOPFileLocationFromScript.script +58 -0
  45. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_EclipseLocation.script +130 -0
  46. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ElectricPropulsion.script +343 -0
  47. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ExternalForceModel.script +115 -0
  48. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ExternalForceModel_NoAPI.script +109 -0
  49. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_FileInterface.script +69 -0
  50. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_FiniteBurn.script +267 -0
  51. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_FiniteBurnParameters.script +92 -0
  52. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ForceModel_ExtraShadowBodies.script +216 -0
  53. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ForceModels.script +368 -0
  54. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_GEOTransfer.script +305 -0
  55. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_GMATFunction_Math.script +32 -0
  56. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_GMATFunction_TargetInsideFunction.script +190 -0
  57. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_GMATFunction_UsingGlobalObjects.script +401 -0
  58. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_GivenEpochGoToTheMoon.script +508 -0
  59. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_HighFidelitySRP.script +46 -0
  60. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_HohmannTransfer.script +128 -0
  61. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_IOD.script +73 -0
  62. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ImprovedTargeterAlgorithms.script +63 -0
  63. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_IncludeMacro.script +69 -0
  64. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Integrators.script +161 -0
  65. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_IntrusionLocator_Mercury_Sun_Transit.script +131 -0
  66. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_L2Design.script +227 -0
  67. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_LCROSSTrajectory.script +494 -0
  68. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_LEOStationKeeping.script +163 -0
  69. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_LibrationPointStationKeeping_ESM.script +227 -0
  70. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_LunarOrbitStationKeeping.script +166 -0
  71. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_LunarTransfer.script +332 -0
  72. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MMSSingleLunarSwingby.script +357 -0
  73. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MarsBPlane.script +356 -0
  74. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MarsExponentialAtmosphere.script +85 -0
  75. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MarsGRAM2005.script +83 -0
  76. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MarsOrbit.script +305 -0
  77. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MathInScript.script +222 -0
  78. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_MultibodySphericalHarmonicGravity.script +134 -0
  79. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_NadirPointingAttitude.script +73 -0
  80. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_NewFunctions_GetEphemStates.script +34 -0
  81. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_NewMathFunctions.script +53 -0
  82. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_NewOrbitStateReps.script +87 -0
  83. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_NewStringFunctions.script +51 -0
  84. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_OEMPropagation.script +86 -0
  85. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_PlanetographicRegion.script +87 -0
  86. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_PrecessingSpinnerAttitude.script +72 -0
  87. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Propagate_Covariance.script +107 -0
  88. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Propagate_ThrustHistoryFile.script +104 -0
  89. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_PythonInterface.script +43 -0
  90. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_SPICECoordinateAxes.script +93 -0
  91. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_SPICEOrbitAndAttitudePropagation.script +111 -0
  92. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_STKEphemOutput.script +56 -0
  93. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_STKEphemPropagation.script +96 -0
  94. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_SafetyEllipse.script +393 -0
  95. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_SchattenFile_NominalCycle_Mean.script +87 -0
  96. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_SolverConvergenceParameters.script +67 -0
  97. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_StationContactLocator.script +138 -0
  98. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_TLE_Propagation.script +57 -0
  99. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_TargetFiniteBurn_CenterPeriapsisDuration.script +311 -0
  100. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_TargetFiniteBurn_CenterPeriapsisTA.script +317 -0
  101. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_TargetStatusWindow.script +260 -0
  102. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_ThrusterWithMultipleTanks.script +86 -0
  103. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_WriteCommand.script +26 -0
  104. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Yukon_AlgebraicOptimization.script +83 -0
  105. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Ex_Yukon_MarsLaunchWindowAnalysis.script +333 -0
  106. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_CompareEphemeris.script +57 -0
  107. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_AngleData.script +264 -0
  108. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_BRTSTracking.script +252 -0
  109. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_NPlateSRP_AreaCoefficient.script +270 -0
  110. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_RangeRangeRate.script +241 -0
  111. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_RangeSkin.script +228 -0
  112. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_SPADDragScaleFactor.script +249 -0
  113. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_SPADSRPScaleFactor.script +250 -0
  114. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_TDRSAndUser.script +353 -0
  115. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_TDRSOneWayReturnDoppler.script +314 -0
  116. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_TDRSUserTracking.script +319 -0
  117. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_ThrustAngles.script +217 -0
  118. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_ThrustScaleFactor.script +299 -0
  119. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Estimate_With_Initial_OrbitErrorCovariance.script +240 -0
  120. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_FilterSmoother_GpsPosVec.script +216 -0
  121. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_MultiSpacecraft_Simultaneous_BatchEstimation.script +304 -0
  122. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_OEM_EphemerisCompare.script +497 -0
  123. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_RICdelta.gmf +71 -0
  124. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_SGP4ToHighFidelity.script +83 -0
  125. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Second_Level_Data_Editing.script +271 -0
  126. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Simulate_And_Estimate_OEMPropagator.script +179 -0
  127. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Simulate_and_Process_GpsPosVec_data.script +160 -0
  128. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Ex_Simulate_and_Process_Range_and_RangeRate_data.script +238 -0
  129. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Navigation/Simulate_DSN_Range_then_Estimate_CartesianState_and_Cr.script +292 -0
  130. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedMatlab/Ex_CallMatlabFunctions.script +45 -0
  131. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedMatlab/Ex_MatlabEnv.script +50 -0
  132. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_Attitude_Inertial.script +99 -0
  133. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_Attitude_NadirPointing.script +124 -0
  134. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_ConstellationScript.script +343 -0
  135. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_CustomSegmentColors.script +243 -0
  136. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_DoubleLunarSwingby.script +322 -0
  137. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_ElectricPropulsion.script +291 -0
  138. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_FieldOfView.script +570 -0
  139. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_FiniteBurn.script +321 -0
  140. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_GEOTransfer.script +376 -0
  141. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_GivenEpochGoToTheMoon.script +612 -0
  142. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_HiFiEarthMoon.script +502 -0
  143. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_HohmannTransfer.script +243 -0
  144. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_LCROSSTrajectory.script +925 -0
  145. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_LibrationPointStationKeeping_ESM.script +209 -0
  146. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_LunarTransfer.script +311 -0
  147. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_MMSSingleLunarSwingby.script +425 -0
  148. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_MarsOrbit.script +544 -0
  149. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_RealTimeMOC.script +628 -0
  150. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_SPICEOrbitAndAttitudePropagation.script +104 -0
  151. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_SafetyEllipse.script +452 -0
  152. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_VR_2017SolarEclipse.script +213 -0
  153. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedOpenFramesInterface/Ex_OFI_Yukon_MarsLaunchWindowAnalysis.script +652 -0
  154. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedSNOPT/Ex_AlgebraicOptimization.script +68 -0
  155. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedSNOPT/Ex_MinFuelLunarTransfer.script +370 -0
  156. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedSNOPT/Ex_OptFiniteBurn.script +307 -0
  157. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_AlgebraicOptimization.script +74 -0
  158. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_LunarCubeSatWithElectricPropulsion.script +650 -0
  159. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_MarsLaunchWindowAnalysis.script +445 -0
  160. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_MarsPatchConic.script +453 -0
  161. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_MinFuelLunarTransfer.script +367 -0
  162. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_MonitoredLunarTransfer.script +246 -0
  163. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_OptimalLCROSSTrajectory.script +1631 -0
  164. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Ex_OptimalLunarApsidesRotation_2Burn.script +185 -0
  165. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Tut_MultipleShootingTutorial_Step1.script +428 -0
  166. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Tut_MultipleShootingTutorial_Step2.script +417 -0
  167. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Tut_MultipleShootingTutorial_Step3.script +442 -0
  168. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Tut_MultipleShootingTutorial_Step4.script +449 -0
  169. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/NeedVF13ad/Tut_MultipleShootingTutorial_Step5.script +451 -0
  170. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_CelestialBodyRendezvous_Mars.script +366 -0
  171. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_EMTGSpacecraft_SCOpt_BusPowerType0.script +194 -0
  172. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_EMTGSpacecraft_SCOpt_PowerSupplyCurve1.script +192 -0
  173. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_EMTGSpacecraft_SCOpt_ThrustType1.script +180 -0
  174. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_EarthToMarsSOI_C3Eq0_CSALTTutorial.script +382 -0
  175. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_IntegratedFlyby_MarsFlyby.script +426 -0
  176. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_OCPropTest_GEO_4x4.script +195 -0
  177. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_PCLaunch_ConstrainedC3AndDLA_EarthLaunch_EarthOrigin.script +345 -0
  178. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/OptimalControl/Ex_Phase_Type_ImplicitRKOrder6.script +195 -0
  179. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/SupportFiles/Ex_EphemerisCompareGeneric.script +553 -0
  180. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/SupportFiles/Ex_IncludeFile.script +34 -0
  181. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_ElectricPropulsionModelling.script +254 -0
  182. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Inter_Spacecraft_Tracking.script +212 -0
  183. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Mars_B_Plane_Targeting.script +337 -0
  184. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Orbit_Estimation_using_DSN_Range_and_Doppler_Data.script +211 -0
  185. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_SimpleOrbitTransfer.script +187 -0
  186. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Simulate_DSN_Range_and_Doppler_Data.script +141 -0
  187. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Simulate_DSN_Range_and_Doppler_Data_3_weeks.script +179 -0
  188. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_SimulatingAnOrbit.script +143 -0
  189. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_Target_Finite_Burn_to_Raise_Apogee.script +255 -0
  190. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/samples/Tut_UsingGMATFunctions.script +367 -0
  191. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/ComposeQuaternions.gmf +23 -0
  192. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/GMATFunction_1st_Targeter_In_Function_2nd_In_Script.gmf +42 -0
  193. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/PropagateQuaternion.gmf +50 -0
  194. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/QualityFactor.gmf +146 -0
  195. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/TargetLEOStationKeeping.gmf +16 -0
  196. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/TargeterInsideFunction.gmf +35 -0
  197. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/ToggleQuaternion.gmf +21 -0
  198. gmat_script-0.1.0/tests/data/corpus/gmat-r2026a/userfunctions/gmat/cross.gmf +9 -0
  199. gmat_script-0.1.0/tests/data/corpus/gmat_function.gmf +18 -0
  200. gmat_script-0.1.0/tests/data/corpus/mission_sequence.script +44 -0
  201. gmat_script-0.1.0/tests/test_cli.py +288 -0
  202. gmat_script-0.1.0/tests/test_corpus.py +128 -0
  203. gmat_script-0.1.0/tests/test_parser.py +132 -0
  204. gmat_script-0.1.0/tests/test_smoke.py +48 -0
  205. gmat_script-0.1.0/tree-sitter-gmat/bindings/python/binding.c +35 -0
  206. gmat_script-0.1.0/tree-sitter-gmat/bindings/python/tree_sitter_gmat/__init__.py +10 -0
  207. gmat_script-0.1.0/tree-sitter-gmat/bindings/python/tree_sitter_gmat/__init__.pyi +3 -0
  208. gmat_script-0.1.0/tree-sitter-gmat/bindings/python/tree_sitter_gmat/py.typed +0 -0
  209. gmat_script-0.1.0/tree-sitter-gmat/grammar.js +424 -0
  210. gmat_script-0.1.0/tree-sitter-gmat/package.json +38 -0
  211. gmat_script-0.1.0/tree-sitter-gmat/queries/highlights.scm +5 -0
  212. gmat_script-0.1.0/tree-sitter-gmat/src/grammar.json +1949 -0
  213. gmat_script-0.1.0/tree-sitter-gmat/src/node-types.json +1897 -0
  214. gmat_script-0.1.0/tree-sitter-gmat/src/parser.c +9079 -0
  215. gmat_script-0.1.0/tree-sitter-gmat/src/scanner.c +272 -0
  216. gmat_script-0.1.0/tree-sitter-gmat/src/tree_sitter/alloc.h +54 -0
  217. gmat_script-0.1.0/tree-sitter-gmat/src/tree_sitter/array.h +291 -0
  218. gmat_script-0.1.0/tree-sitter-gmat/src/tree_sitter/parser.h +286 -0
  219. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/assignment.txt +108 -0
  220. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/collections.txt +141 -0
  221. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/control_flow.txt +201 -0
  222. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/create.txt +129 -0
  223. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/function_call.txt +94 -0
  224. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/function_def.txt +77 -0
  225. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/include.txt +23 -0
  226. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/layout.txt +35 -0
  227. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/mission_sequence.txt +268 -0
  228. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/quirks.txt +47 -0
  229. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/recovery.txt +62 -0
  230. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/script_block.txt +46 -0
  231. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/solver_blocks.txt +145 -0
  232. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/unquoted_values.txt +74 -0
  233. gmat_script-0.1.0/tree-sitter-gmat/test/corpus/values.txt +168 -0
  234. gmat_script-0.1.0/tree-sitter-gmat/tree-sitter.json +37 -0
@@ -0,0 +1,47 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.pyd
7
+ *.dylib
8
+ *.egg
9
+ *.egg-info/
10
+ .eggs/
11
+ build/
12
+ dist/
13
+ wheels/
14
+ *.whl
15
+
16
+ # Environments
17
+ .venv/
18
+ venv/
19
+ env/
20
+ .env
21
+
22
+ # uv
23
+ .uv-cache/
24
+
25
+ # Tooling caches
26
+ .pytest_cache/
27
+ .mypy_cache/
28
+ .ruff_cache/
29
+ .coverage
30
+ .coverage.*
31
+ coverage.xml
32
+ htmlcov/
33
+
34
+ # Docs build
35
+ site/
36
+ .cache/
37
+
38
+ # Node / tree-sitter (the generated parser under tree-sitter-gmat/src/ IS committed)
39
+ node_modules/
40
+ tree-sitter-gmat/build/
41
+ *.wasm
42
+
43
+ # IDE / editor
44
+ .vscode/
45
+ .idea/
46
+ *.swp
47
+ .DS_Store
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to gmat-script are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
6
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] — 2026-06-07
11
+
12
+ Initial release: a tree-sitter grammar for GMAT mission scripts and an install-free Python parser
13
+ built on it.
14
+
15
+ ### Added
16
+
17
+ - **Tree-sitter grammar** for GMAT `.script` and GmatFunction (`.gmf`) files — one grammar for both,
18
+ a deliberately permissive superset: `Create <Type> <name>` accepts any resource type and unknown
19
+ commands parse as generic command nodes, so a new resource or command never needs a grammar
20
+ change. Every input re-emits **byte-for-byte**, comments and layout included. The acceptance bar is
21
+ concrete: all 162 `.script` and 9 `.gmf` files shipped with NASA GMAT R2026a parse with zero
22
+ `ERROR` nodes and round-trip exactly (#2, #4, #5, #8).
23
+ - **`parse()` API** — `parse(text)` returns a `Tree` that never raises on malformed input; syntax
24
+ problems surface as `ERROR` / `MISSING` nodes localised through `tree.errors`, alongside
25
+ `tree.has_errors` and a byte-exact `tree.to_source()` (#6, #9).
26
+ - **`gmat-script parse` CLI** — a fast, install-free syntax gate: it prints the syntax tree and exits
27
+ non-zero on a syntax error, with a machine-readable `--json` `{file, ok, errors}` report (#7).
28
+ - **Packaging** — `pip install gmat-script` ships a precompiled grammar in a stable-ABI wheel for
29
+ Python 3.10–3.12 on Linux, macOS, and Windows; the only runtime dependency is `tree-sitter`, and no
30
+ C or Node toolchain — and never a GMAT install — is required (#3).
31
+ - **Documentation** — getting-started, the grammar-surface reference, the `parse` CLI and
32
+ error-reporting guides, and the API reference, published to GitHub Pages (#3, #10).
@@ -0,0 +1,24 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use gmat-script in academic work, please cite it using the metadata below."
3
+ title: gmat-script
4
+ abstract: >-
5
+ gmat-script is a permissively-licensed Python library and tree-sitter grammar for GMAT mission
6
+ scripts. It parses GMAT .script and GmatFunction (.gmf) files into a concrete syntax tree that
7
+ re-emits byte-for-byte, and layers a typed AST with a mutation API, a canonical formatter, a
8
+ linter, and editor tooling on top. The whole stack operates on script text and needs no GMAT
9
+ install.
10
+ type: software
11
+ authors:
12
+ - given-names: Dimitrije
13
+ family-names: Jankovic
14
+ version: 0.1.0
15
+ date-released: "2026-06-07"
16
+ license: MIT
17
+ repository-code: "https://github.com/astro-tools/gmat-script"
18
+ url: "https://github.com/astro-tools/gmat-script"
19
+ keywords:
20
+ - gmat
21
+ - tree-sitter
22
+ - parser
23
+ - astrodynamics
24
+ - mission-analysis
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 astro-tools
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: gmat-script
3
+ Version: 0.1.0
4
+ Summary: Parse, format, lint, and edit GMAT mission scripts from Python — a tree-sitter grammar and tooling.
5
+ Project-URL: Homepage, https://github.com/astro-tools/gmat-script
6
+ Project-URL: Repository, https://github.com/astro-tools/gmat-script
7
+ Project-URL: Issues, https://github.com/astro-tools/gmat-script/issues
8
+ Project-URL: Documentation, https://astro-tools.github.io/gmat-script/
9
+ Project-URL: Changelog, https://github.com/astro-tools/gmat-script/blob/main/CHANGELOG.md
10
+ Author: Dimitrije Jankovic
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: astrodynamics,formatter,gmat,linter,mission-analysis,parser,tree-sitter
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
27
+ Classifier: Topic :: Software Development :: Compilers
28
+ Classifier: Topic :: Text Processing :: Linguistic
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.10
31
+ Requires-Dist: tree-sitter<0.26,>=0.25
32
+ Description-Content-Type: text/markdown
33
+
34
+ # gmat-script
35
+
36
+ Parse, format, lint, and edit [GMAT](https://gmat.gsfc.nasa.gov/) `.script` mission files from
37
+ Python — built on a [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar. The whole
38
+ stack operates on script **text**; nothing here requires a GMAT install.
39
+
40
+ Today it ships the parser and the `gmat-script parse` command-line tool. The typed AST and mutation
41
+ API, the canonical formatter, the linter, and the editor tooling build on top of the same tree as
42
+ they land.
43
+
44
+ ## Install
45
+
46
+ ```bash
47
+ pip install gmat-script
48
+ ```
49
+
50
+ gmat-script supports Python 3.10, 3.11, and 3.12. The wheel bundles a precompiled grammar, so the
51
+ install needs no C or Node toolchain — and never GMAT.
52
+
53
+ ## Quick start
54
+
55
+ ```python
56
+ from gmat_script import parse
57
+
58
+ tree = parse("Create Spacecraft Sat\nSat.SMA = 7000\n")
59
+
60
+ tree.has_errors # False — the script is well-formed
61
+ tree.to_source() # round-trips byte-for-byte to the input
62
+ ```
63
+
64
+ `parse` never raises on malformed input: it returns a tree carrying `ERROR` / `MISSING` nodes
65
+ localised to the broken construct, surfaced through `tree.errors`. The same engine drives the CLI,
66
+ a fast, install-free syntax gate for CI:
67
+
68
+ ```console
69
+ $ gmat-script parse mission.script # prints the syntax tree; exits non-zero on a syntax error
70
+ $ gmat-script parse --json mission.script # machine-readable {file, ok, errors} report
71
+ ```
72
+
73
+ ## The grammar surface
74
+
75
+ The tree-sitter grammar parses GMAT scripts (`.script`) and GmatFunctions (`.gmf`) — the same
76
+ grammar for both — and re-emits any input **byte-for-byte**, comments and layout included. It is a
77
+ deliberately permissive superset: `Create <Type> <name>` accepts any resource type and unknown
78
+ command keywords parse as generic command nodes, so a new resource or command never needs a grammar
79
+ change. The acceptance bar is concrete: every one of the 162 `.script` and 9 `.gmf` files shipped
80
+ with NASA GMAT R2026a parses with zero errors and round-trips exactly.
81
+
82
+ See the [grammar surface reference](https://astro-tools.github.io/gmat-script/grammar-surface/) for
83
+ the node taxonomy and the covered / deferred constructs.
84
+
85
+ ## The GMAT-free guarantee
86
+
87
+ Reading, checking, formatting, and transforming a script needs only this package — never a GMAT
88
+ install. `pip install gmat-script` never pulls in, requires, or looks for GMAT or `gmatpy`; the only
89
+ runtime dependency is `tree-sitter`. (GMAT is used at build time only, to generate the field
90
+ catalogue that later semantic tooling will check against.)
91
+
92
+ ## GMAT version
93
+
94
+ The grammar targets **GMAT R2026a**. Because it never enumerates resource types or command keywords,
95
+ parsing is effectively version-independent — scripts from other releases parse too. Semantics that
96
+ *do* vary by release (valid field names, enums, defaults) belong to the later linter and are scoped
97
+ to R2026a.
98
+
99
+ ## What gmat-script is not
100
+
101
+ - **Not a propagator or astrodynamics engine.** It reads and transforms script *text*; it computes
102
+ no orbits and models no physics.
103
+ - **Not a mission runner.** Running a script is GMAT's job — gmat-script does no execution.
104
+ - **Not an engine-dependent validator.** "Does it parse" is a structural question answered here;
105
+ "does it run / converge" is a different question that needs GMAT.
106
+
107
+ ## Documentation
108
+
109
+ Full documentation — getting started, the grammar surface, the `parse` CLI, the error-reporting
110
+ model, and the API reference — is at
111
+ **[astro-tools.github.io/gmat-script](https://astro-tools.github.io/gmat-script/)**.
112
+
113
+ ## License
114
+
115
+ [MIT](LICENSE) — part of the [astro-tools](https://github.com/astro-tools) organization.
@@ -0,0 +1,82 @@
1
+ # gmat-script
2
+
3
+ Parse, format, lint, and edit [GMAT](https://gmat.gsfc.nasa.gov/) `.script` mission files from
4
+ Python — built on a [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar. The whole
5
+ stack operates on script **text**; nothing here requires a GMAT install.
6
+
7
+ Today it ships the parser and the `gmat-script parse` command-line tool. The typed AST and mutation
8
+ API, the canonical formatter, the linter, and the editor tooling build on top of the same tree as
9
+ they land.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install gmat-script
15
+ ```
16
+
17
+ gmat-script supports Python 3.10, 3.11, and 3.12. The wheel bundles a precompiled grammar, so the
18
+ install needs no C or Node toolchain — and never GMAT.
19
+
20
+ ## Quick start
21
+
22
+ ```python
23
+ from gmat_script import parse
24
+
25
+ tree = parse("Create Spacecraft Sat\nSat.SMA = 7000\n")
26
+
27
+ tree.has_errors # False — the script is well-formed
28
+ tree.to_source() # round-trips byte-for-byte to the input
29
+ ```
30
+
31
+ `parse` never raises on malformed input: it returns a tree carrying `ERROR` / `MISSING` nodes
32
+ localised to the broken construct, surfaced through `tree.errors`. The same engine drives the CLI,
33
+ a fast, install-free syntax gate for CI:
34
+
35
+ ```console
36
+ $ gmat-script parse mission.script # prints the syntax tree; exits non-zero on a syntax error
37
+ $ gmat-script parse --json mission.script # machine-readable {file, ok, errors} report
38
+ ```
39
+
40
+ ## The grammar surface
41
+
42
+ The tree-sitter grammar parses GMAT scripts (`.script`) and GmatFunctions (`.gmf`) — the same
43
+ grammar for both — and re-emits any input **byte-for-byte**, comments and layout included. It is a
44
+ deliberately permissive superset: `Create <Type> <name>` accepts any resource type and unknown
45
+ command keywords parse as generic command nodes, so a new resource or command never needs a grammar
46
+ change. The acceptance bar is concrete: every one of the 162 `.script` and 9 `.gmf` files shipped
47
+ with NASA GMAT R2026a parses with zero errors and round-trips exactly.
48
+
49
+ See the [grammar surface reference](https://astro-tools.github.io/gmat-script/grammar-surface/) for
50
+ the node taxonomy and the covered / deferred constructs.
51
+
52
+ ## The GMAT-free guarantee
53
+
54
+ Reading, checking, formatting, and transforming a script needs only this package — never a GMAT
55
+ install. `pip install gmat-script` never pulls in, requires, or looks for GMAT or `gmatpy`; the only
56
+ runtime dependency is `tree-sitter`. (GMAT is used at build time only, to generate the field
57
+ catalogue that later semantic tooling will check against.)
58
+
59
+ ## GMAT version
60
+
61
+ The grammar targets **GMAT R2026a**. Because it never enumerates resource types or command keywords,
62
+ parsing is effectively version-independent — scripts from other releases parse too. Semantics that
63
+ *do* vary by release (valid field names, enums, defaults) belong to the later linter and are scoped
64
+ to R2026a.
65
+
66
+ ## What gmat-script is not
67
+
68
+ - **Not a propagator or astrodynamics engine.** It reads and transforms script *text*; it computes
69
+ no orbits and models no physics.
70
+ - **Not a mission runner.** Running a script is GMAT's job — gmat-script does no execution.
71
+ - **Not an engine-dependent validator.** "Does it parse" is a structural question answered here;
72
+ "does it run / converge" is a different question that needs GMAT.
73
+
74
+ ## Documentation
75
+
76
+ Full documentation — getting started, the grammar surface, the `parse` CLI, the error-reporting
77
+ model, and the API reference — is at
78
+ **[astro-tools.github.io/gmat-script](https://astro-tools.github.io/gmat-script/)**.
79
+
80
+ ## License
81
+
82
+ [MIT](LICENSE) — part of the [astro-tools](https://github.com/astro-tools) organization.
@@ -0,0 +1,11 @@
1
+ # API reference
2
+
3
+ The public surface of `gmat_script`. It is deliberately minimal and additive — today it is the
4
+ `parse` entry point and the `Tree` it returns, plus the `ErrorNode` / `Position` records that
5
+ describe syntax errors. Later layers (the typed AST, the formatter) are re-exported here as they
6
+ land.
7
+
8
+ For a worked introduction see [Getting started](getting-started.md); for the error model see
9
+ [Error reporting](errors.md).
10
+
11
+ ::: gmat_script
@@ -0,0 +1,115 @@
1
+ # The `parse` CLI
2
+
3
+ Installing gmat-script puts a `gmat-script` console script on your `PATH`. Its `parse` subcommand is
4
+ a fast, install-free syntax gate: it parses `.script` / `.gmf` files and reports their syntax trees,
5
+ exiting non-zero when any input has a syntax error. It needs no GMAT, C, or Node toolchain at
6
+ runtime.
7
+
8
+ ```console
9
+ $ gmat-script parse --help
10
+ usage: gmat-script parse [-h] [-q] [--json] FILE [FILE ...]
11
+
12
+ Parse each FILE (or '-' for stdin) and print its syntax tree as an
13
+ S-expression. Exits non-zero if any file has a syntax error.
14
+
15
+ positional arguments:
16
+ FILE Path to a .script or .gmf file, or '-' to read from stdin.
17
+
18
+ options:
19
+ -h, --help show this help message and exit
20
+ -q, --quiet Suppress the syntax tree; print only error diagnostics.
21
+ --json Emit a machine-readable JSON report instead of the
22
+ S-expression.
23
+ ```
24
+
25
+ ## Default output — the S-expression
26
+
27
+ By default, `parse` prints each file's tree as a tree-sitter S-expression to stdout. Any
28
+ `ERROR` / `MISSING` node is reported on stderr as `FILE:line:col: <message>` (positions are
29
+ 1-indexed).
30
+
31
+ ```console
32
+ $ gmat-script parse mission.script
33
+ (source_file (create_command type: (identifier) name: (identifier)) (assignment_command left: (member_expression object: (identifier) property: (identifier)) right: (number)))
34
+ ```
35
+
36
+ Read from stdin by passing `-`:
37
+
38
+ ```console
39
+ $ printf 'Create Spacecraft Sat\nSat.SMA = 7000\n' | gmat-script parse -
40
+ (source_file (create_command type: (identifier) name: (identifier)) (assignment_command left: (member_expression object: (identifier) property: (identifier)) right: (number)))
41
+ ```
42
+
43
+ With more than one file, each tree is prefixed by a `; <file>` header (an S-expression comment) so
44
+ the trees stay attributable; a single file's tree is printed bare.
45
+
46
+ ## `--quiet` — diagnostics only
47
+
48
+ `--quiet` suppresses the tree (and its header), leaving only the stderr diagnostics. This is the form
49
+ you want in CI when you only care whether a file is well-formed:
50
+
51
+ ```console
52
+ $ printf 'Sat.SMA = \n' | gmat-script parse --quiet -
53
+ <stdin>:1:1: unexpected token
54
+ ```
55
+
56
+ A clean file under `--quiet` prints nothing and exits 0.
57
+
58
+ ## `--json` — a machine-readable report
59
+
60
+ `--json` emits a `{file, ok, errors}` report instead of the S-expression. `ok` mirrors the exit code
61
+ (`true` ⇔ exit 0). Positions are 1-indexed for both line and column.
62
+
63
+ ```console
64
+ $ printf 'Create Spacecraft Sat\nSat.SMA = \n' | gmat-script parse --json -
65
+ {
66
+ "file": "<stdin>",
67
+ "ok": false,
68
+ "errors": [
69
+ {
70
+ "type": "ERROR",
71
+ "start": {
72
+ "line": 2,
73
+ "column": 1
74
+ },
75
+ "end": {
76
+ "line": 2,
77
+ "column": 10
78
+ },
79
+ "message": "unexpected token"
80
+ }
81
+ ]
82
+ }
83
+ ```
84
+
85
+ A clean file reports `"ok": true` with an empty `errors` list:
86
+
87
+ ```console
88
+ $ printf 'Create Spacecraft Sat\n' | gmat-script parse --json -
89
+ {
90
+ "file": "<stdin>",
91
+ "ok": true,
92
+ "errors": []
93
+ }
94
+ ```
95
+
96
+ For a single file the report is one JSON object; for several files it is a JSON array of reports.
97
+
98
+ ## Exit codes
99
+
100
+ | Code | Meaning |
101
+ |------|---------|
102
+ | `0` | every file parsed with no `ERROR` / `MISSING` node |
103
+ | `1` | at least one file had a syntax error |
104
+ | `2` | a file could not be read (an operational error, distinct from a syntax error) |
105
+
106
+ The `1` / `0` split is the CI contract: drop `gmat-script parse` into a pipeline and a syntax
107
+ regression fails the build.
108
+
109
+ ## A note on output encoding
110
+
111
+ Stdout stays ASCII — S-expressions are node-type names, and the JSON report is emitted with
112
+ `ensure_ascii`, so non-ASCII source never reaches stdout. A Windows console under a legacy code page
113
+ cannot choke on it.
114
+
115
+ For the structure of the error records, see [Error reporting](errors.md).