Skip to content

Use a lazy builtins file generated from docs for igor pro#2221

Open
jneen wants to merge 1 commit intomainfrom
maint.igor-pro-lazy-builtins
Open

Use a lazy builtins file generated from docs for igor pro#2221
jneen wants to merge 1 commit intomainfrom
maint.igor-pro-lazy-builtins

Conversation

@jneen
Copy link
Member

@jneen jneen commented Feb 25, 2026

Factors out igorpro/builtins.rb which is lazily loaded on first lexer initialization. Docs are generated from the HTML at https://docs.wavemetrics.com/igorpro/commands

@jneen
Copy link
Member Author

jneen commented Feb 25, 2026

@MichaelHuth Can I ask you to take a look here? I want to make sure the way I'm generating these builtin lists from the docs makes some amount of sense, and I'm not super familiar with Igor Pro. In particular, if there's a more conveniently available machine-readable source for this, it might be better than scraping the docs site.

@jneen jneen force-pushed the maint.igor-pro-lazy-builtins branch from 6c6e7d6 to f5f6a7d Compare February 25, 2026 23:31
@jneen
Copy link
Member Author

jneen commented Feb 25, 2026

Also tagging @t-b as an Igor Pro user.

@t-b
Copy link
Contributor

t-b commented Feb 26, 2026

@jneen Thanks for tagging us. Fetching Operations and Functions from their documentation website (which is only available since a couple of weeks) is a good idea. But this removes all non-builtins. These are popular addons (called XOPs). The missing ones start with:

  • zeromq
  • Axon
  • MCC
  • HDF
  • fDAQmx_
  • VDT
  • VISA
  • TUFXOP
  • NI
  • NC
  • MFR
  • JSONXOP
  • ITC
  • GPIB
  • GIS
  • FCALL
  • DAQmx
  • vi
  • TDM

As newer Igor Pro versions only contain more operations/functions it is also possible to just add everything back in which is present in the old list but not in the new one.

@jneen
Copy link
Member Author

jneen commented Feb 26, 2026

I see! Are these XOPs documented (ideally in a machine-readable way) somewhere we can fetch?

functions.uniq!

# ensure disjoint
operations -= functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are Operations with the same name as Functions in Igor Pro, e.g. "note". Thus, this line needs to be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rouge can only highlight them as one kind of token, though - which is best in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, if there is context that can distinguish them, Rouge can detect that, but the current IgorPro lexer only checks inclusion in these:

          elsif self.class.igorFunction.include? m[0].downcase
            token Name::Builtin
          elsif self.class.igorOperation.include? m[0].downcase
            token Keyword::Reserved
            push :operationFlags

(also we're checking inclusion of the lowercased version, which means anything in either of these sets with a capital letter is currently ignored. this generator downcases the source as well.)

@MichaelHuth
Copy link
Contributor

As anyone can write XOPs there is probably no machine readable documentation for the general case. For the XOPs that we developed there is sphinx generated documentation, e.g. at
JSON-XOP: https://docs.byte-physics.de/json-xop/
or
TUF-XOP: https://docs.byte-physics.de/tuf-xop/

more XOP docu can be found through the links here https://www.byte-physics.de/en/projects.html

So I guess you still need some list for the non-builtins.

@jneen
Copy link
Member Author

jneen commented Feb 26, 2026

To be blunt, I would rather not maintain a giant definitive list of all known functions in this framework that I don't use, unless there is a way to automate it. I think if there are XOPs that we can fetch and process automatically in the generator task, I'm happy to include them, though.

@t-b
Copy link
Contributor

t-b commented Feb 26, 2026

I think I'm missing the motivation for the PR.

All the relevant content changes to the IgorPro lexers where done by some of our guys e.g.

git log --pretty="%ae" lib/rouge/lexers/igorpro.rb
michael.huth@byte-physics.de
larouxn@gmail.com
ashmaroli@users.noreply.github.com
mike@inqk.net
ashmaroli@gmail.com
thomas.braun@byte-physics.de
ashmaroli@gmail.com
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
gfuji@cpan.org
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de
matthias.kastner@byte-physics.de

and if there is something wrong we are happy to fix it. But I don't see the point in autogenerating the list of operations/functions as that only changes every few years. And can only be done correctly with the program manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants