What happened (e.g., it crashed)?:
If you have: Let |p| be new Promise...
But what I was expecting?:
It should convert |p| to <var>p</var>.
Similarly, if you have: Let |p:Promise| be newly created Promise.
The issue is with the regex for inline variables:
https://github.com/w3c/respec/blob/1121be0cdb5244b12a6462993b64cc6f59ba77b8/src/core/inlines.js#L140
Changing it to "\\B\\|\\w[\\s\\w]*(?:\\s*\\:\\s*\\w+)?\\|\\B" fixed the issue for me (i.e remove word character matching \\w in the middle), and also passes the tests in inlines-spec.js.
But I don't really know RegEx, so @sidvishnoi what was the reason to match another word character?
New regex by @Swapnilr1 looks good to me. But I'll see if there are some other use cases and if we can simplify it.
@sidvishnoi There is an issue with
/\B\|\w[\w\s]*(?:\s*\:.+)?\|\B/

means that var1 becomes the name and long| and |p becomes the type.
The alternative
/\B\|\w[\w\s]*(?:\s*\:[\w\s&;<>]+)?\|\B/
does not cause this error - but I think I am better off seeing a regular expressions reference rather than just trying out strings. Don't want to introduce another bug while fixing this - so need some time.
Yes, I was concerned about over-matching (See https://github.com/w3c/respec/issues/2184#issuecomment-476075781)
We need to stop the regex search at first |, and not go any further.
The second one works because neither of [\w\s&;<>] includes |, but .+ will match |, causing over-matching.
Yes, l understood why the first one overmatches, but that was only after I found a case where it overmatches. Specifying allowed characters is a safe approach.
Does [\w\s&;<>] cover all allowed characters? I have encountered &;<> for the first time as valid characters in variable types :open_mouth: so I don't have much of an idea on what is allowed and what is not.
@Swapnilr1 here is a comprehensive list of types:
https://heycam.github.io/webidl/#idl-types
See the more complex ones, like union, annotated, etc...
(note we don't need to process the types yet... we will do that eventually).