Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
F
finesse3
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 98
    • Issues 98
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 3
    • Merge Requests 3
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • finesse
  • finesse3
  • Issues
  • #200

Closed
Open
Opened Oct 23, 2020 by Sean Leavey@sean-leaveyMaintainer0 of 1 task completed0/1 task

Unparse models to the same order as defined in script used to parse

When a user parses kat script to a model, changes some things and unparses to kat script again, there should be an option (probably on by default) which makes the generator write the same instructions back to the file in the same order they appear in the input script.

If the user only modifies parameter values then this is trivial, but if they add or remove components this gets more complicated. At that point it should probably just fall back to adding new lines under the first or last instruction that the new lines depend on, else add it to the end.

We could have an in-place option that overwrites the input file (first writing to a temporary file and replacing, so the operation i atomic). We probably also would then need some user-configurable backup policy for this, storing the last N versions as e.g. input_file.kat.backup-2020-10-23-10:34:30.

Update from 2020-11-26 telecon

We discussed this and decided that retaining comments and whitespace from parsed files in unparsed files is a key feature for the final v1 release of Finesse 3, since this will be the primary paradigm we suggest users follow when modelling detectors (where you need to perform multiple simulations, change things, and run them again later - and pass files around different users who might add their own comments etc.). However, these changes will not be required for alpha 1 since they don't affect the actual kat script syntax behaviour itself - which is what we want to primarily demonstrate there. This means that when alpha 1 gets released, we should tell users that the unparser is only there for demonstration but not as something to yet rely on, since its behaviour will likely change later.

Todo

  • Retain the parsed script style (including comments, whitespace, etc.) in parsed models and use this to generate kat script from a model - requires whitespace, comments, etc. to be tokenised and retained in the AST. Probably requires a new parsing algorithm (e.g. PEG parser used by Python 3.9).
Edited Nov 26, 2020 by Sean Leavey
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Release Candidate 1
Milestone
Release Candidate 1
Assign milestone
Time tracking
None
Due date
None
Reference: finesse/finesse3#200