Skip to content

Conversation

@physikerwelt
Copy link
Member

do not merge!

"\\gnapprox",
"\\gneq",
"\\gneqq",
"\\gnsim",
Copy link
Member Author

Choose a reason for hiding this comment

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

why do you need this lists.

@physikerwelt
Copy link
Member Author

@notjagan I think coping from files from texvcjs is not a good idea. Why can't you add texvc as node dependency?

@notjagan
Copy link
Contributor

notjagan commented Aug 9, 2016

@physikerwelt I was originally planning on having texvcjs as a dependency for texer. However, in order for me to create parsing for the macro definitions based on DRMFfcns.sty, I need to dynamically modify the files belonging to texvcjs. For example, I have to add code to parser.pegjs for each of the functions specified within the .sty file, which wouldn't be easily possible with texvcjs simply as a dependency.

@notjagan
Copy link
Contributor

@physikerwelt What would you recommend in terms of the relationship between texer and texvcjs? I would like add texvcjs as a dependency so I don't have to manually transfer all the changes that I make on texvcjs over to texer, but I have to add code to texvcjs dynamically in texer. As such, I am unsure on how to treat texvcjs as it used in texer. The only idea I have right now is give texvcjs the ability to accept modifications through a function and have it deal with the changes itself.

@physikerwelt
Copy link
Member Author

physikerwelt commented Aug 17, 2016

but I have to add code to texvcjs dynamically in texer. As such, I am unsure on how to treat texvcjs as it used in texer. The only idea I have right now is give texvcjs the ability to accept modifications through a function and have it deal with the changes itself.

In general that seems to be a good approach. But I do not understand the details.

@HowardCohl
Copy link
Member

@notjagan Can you give @physikerwelt some details, as above?

@notjagan
Copy link
Contributor

notjagan commented Aug 17, 2016

@physikerwelt As of right now, my branch of texer reads in macro definitions from DRMFfcns.sty. For example, one such declaration is \defSpecFun{HarmonicNumber}[1]{H_{#1}}[meaning=Harmonic-number]{0}. This means that whenever the pegJS code encounters something of the form H_{literal} it should render it as \HarmonicNumber{literal}. To accomplish this, I wrote code that generates pegJS rules so that this is handled when parser.js is built. In the HarmonicNumber example, the generated pegJS looks like:

"H_" space* l1:lit { return ast.Tex.HarmonicNumber1A("\\HarmonicNumber", l1); }.

In addition to generating pegJS, my code also generates JavaScript for adding rules to ast.js, astutil.js, and render.js. However, because I generate code in the base files of texvcjs, I cannot add texvcjs as a dependency in the form it is currently in. I am considering allowing texvcjs to accept new rules and modify itself, but I am unsure at the moment.

@physikerwelt
Copy link
Member Author

@notjagan the question is where in the pegjs file you want to edit the new rules. If you modify one line in the texvcjs code, i.e make the location of the grammar file configureable
https://github.com/DRMF/texvcjs/blob/master/lib/build-parser.js#L4
you should be able to get quite far.
Or did I miss something?

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