Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTD parsing/scanner updated. More properties for DTD types implemented. #261

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

NikolasKomonen
Copy link
Contributor

Signed-off-by: Nikolas Komonen nikolaskomonen@gmail.com

Before adding unrecognizedParameters

Signed-off-by: Nikolas Komonen nikolaskomonen@gmail.com

asd

Copy link
Contributor

@fbricon fbricon left a comment

Choose a reason for hiding this comment

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

please fix the commit message

@angelozerr
Copy link
Contributor

@NikolasKomonen I have not tried your PR, but the most important thing is to support tolerant parser otherwise outline will not display the other nodes after the DTD content malformed.

In other words, please check at first that a malformed DTD content (ex : <!ATTRLIST name) continue to parse the next content in the outline. For instance

<!ATTRLIST name
<!ELEMENT name >

must display ATTRLIST and !ELEMENT in the outline.

Write more tests with tolerant parser.

@NikolasKomonen
Copy link
Contributor Author

@angelozerr

(ex : <!ATTRLIST name)

Just wanted to confirm, did you mean 'ATTLIST' instead of 'ATTRLIST' or should parsing cover invalid tag names as well.

We will need to implement handling invalid tag names which I can do in this pr.

@angelozerr
Copy link
Contributor

Just wanted to confirm, did you mean 'ATTLIST' instead of 'ATTRLIST' or should parsing cover invalid tag names as well.

Yes I mean that.

We will need to implement handling invalid tag names which I can do in this pr.

Are you sure? For instance we have not that for element or attribute, why do we need that for ATTLIST?

@NikolasKomonen
Copy link
Contributor Author

NikolasKomonen commented Dec 12, 2018

@angelozerr Sorry, I meant that if there was an invalid declaration. eg: <!BBB ...> in the DTD. We dont handle bad tag names. This is another thing to handle for this pr.

@NikolasKomonen NikolasKomonen force-pushed the parserDTDFix branch 3 times, most recently from 654488e to 1079ccf Compare December 14, 2018 13:59
@fbricon
Copy link
Contributor

fbricon commented Dec 14, 2018

with the current PR:

<?xml version = "1.0"?>
<!DOCTYPE Folks [
    <!ELEMENT Folks (Person*)>
    <!ELEMENT Person (Name,Email?)>
    <!ATTLIST Person Pin ID #REQUIRED>
    <!ATTLIST Person Friend IDREF #IMPLIED>
    <!ATTLIST Person Likes IDREFS #IMPLIED>
    <!ELEMENT Name (#PCDATA)>
    <!ELEMENT Email (#PCDATA)>
    ]>
<Folks>
    <Person Pin="dd">
        <Name></Name>
        <Email></Email>
    </Person>
</Folks>

No outline is available. Furthermore, if you cut the all the <!DOCTYPE .. ]> bits and paste them back, an exception is thrown:

java.lang.StringIndexOutOfBoundsException: String index out of range: 264
	at java.lang.String.substring(String.java:1963)
	at org.eclipse.lsp4xml.dom.DTDDeclNode.getValueFromOffsets(DTDDeclNode.java:43)
	at org.eclipse.lsp4xml.dom.DTDElementDecl.getName(DTDElementDecl.java:53)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.nodeToName(XMLSymbolsProvider.java:184)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.findDocumentSymbols(XMLSymbolsProvider.java:89)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.lambda$findDocumentSymbols$2(XMLSymbolsProvider.java:117)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.findDocumentSymbols(XMLSymbolsProvider.java:115)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.lambda$findDocumentSymbols$1(XMLSymbolsProvider.java:72)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.eclipse.lsp4xml.services.XMLSymbolsProvider.findDocumentSymbols(XMLSymbolsProvider.java:67)
	at org.eclipse.lsp4xml.services.XMLLanguageService.findDocumentSymbols(XMLLanguageService.java:98)
	at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$documentSymbol$6(XMLTextDocumentService.java:229)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	... 6 more

@NikolasKomonen NikolasKomonen force-pushed the parserDTDFix branch 4 times, most recently from 9dfe620 to 6e21e5d Compare December 14, 2018 21:38
@fbricon
Copy link
Contributor

fbricon commented Dec 17, 2018

I found that multiple attlists in one declaration are not supported, so only the 1st attribute shows in the outline eg. ant1.6.2.dtd (look at project, target):

screen shot 2018-12-16 at 11 05 40 pm

<?xml version="1.0" encoding="UTF-8" ?>
<!ENTITY % boolean "(true|false|on|off|yes|no)">
<!ENTITY % tasks "propertyfile | ccmkdir | importtypelib | vsscheckin | sql | cvspass | p4reopen | csc | dirname | wlrun | p4label | p4revert | replaceregexp | get | jjtree | sleep | jarlib-display | dependset | zip | patch | jspc | style | test | tstamp | unwar | vsshistory | icontract | cvschangelog | p4submit | ccmcheckin | p4change | bzip2 | sync | p4delete | vssadd | javadoc | p4integrate | translate | signjar | cclock | chown | vajload | jarlib-available | rexec | WsdlToDotnet | buildnumber | jpcovmerge | ejbjar | war | stlist | rename | sequential | serverdeploy | property | subant | move | ildasm | copydir | cccheckin | ccunlock | wljspc | fixcrlf | telnet | sosget | pathconvert | record | p4sync | exec | ccmklabel | p4edit | manifest | maudit | antlr | netrexxc | ftp | jpcovreport | execon | ccmcheckout | ant | xmlvalidate | xslt | p4resolve | iplanet-ejbc | ccmcheckintask | gzip | native2ascii | ccrmtype | starteam | ear | input | presetdef | rmic | checksum | mail | loadfile | vsscheckout | stylebook | soscheckin | mimemail | stlabel | gunzip | concat | cab | touch | parallel | splash | antcall | ccmkbl | cccheckout | typedef | p4have | filter | xmlproperty | import | copy | jsharpc | symlink | antstructure | script | ccmcreatetask | rpm | delete | replace | mmetrics | attrib | waitfor | untar | loadproperties | available | echoproperties | stcheckin | chgrp | vajexport | stcheckout | bunzip2 | whichresource | copyfile | p4labelsync | vsscreate | macrodef | ejbc | unjar | vbc | wsdltodotnet | mkdir | cvs | condition | tempfile | junitreport | ccmkattr | taskdef | echo | ccupdate | java | vsslabel | renameext | basename | javadoc2 | tar | vsscp | vajimport | p4fstat | setproxy | p4counter | wlstop | ilasm | soscheckout | apply | ccuncheckout | jarlib-resolve | jlink | cvstagdiff | javacc | chmod | pvcs | jarlib-manifest | jar | ccmklbtype | sound | scriptdef | defaultexcludes | mparse | blgenclient | uptodate | jjdoc | genkey | javah | ccmkelem | ccmreconfigure | fail | unzip | javac | p4add | jpcoverage | soslabel | depend | vssget | deltree | ddcreator | junit | sshexec | scp">
<!ENTITY % types "patternset | assertions | propertyset | filterset | libfileset | mergemapper | identitymapper | filterreader | unpackagemapper | scriptfilter | concatfilter | extension | fileset | dirset | globmapper | filelist | filterchain | path | compositemapper | classfileset | regexpmapper | selector | xmlcatalog | flattenmapper | description | chainedmapper | packagemapper | mapper | zipfileset | substitution | extensionSet | redirector | regexp">

<!ELEMENT project (target | extension-point | %tasks; | %types;)*>
<!ATTLIST project
          name    CDATA #IMPLIED
          default CDATA #IMPLIED
          basedir CDATA #IMPLIED>

<!ELEMENT target (%tasks; | %types;)*>

<!ATTLIST target
          id          ID    #IMPLIED
          name        CDATA #REQUIRED
          if          CDATA #IMPLIED
          unless      CDATA #IMPLIED
          depends     CDATA #IMPLIED
          extensionOf CDATA #IMPLIED
          description CDATA #IMPLIED>
    ...

@NikolasKomonen
Copy link
Contributor Author

@fbricon This is a symbols issue, all the values are there for this functionality to be implemented.

@fbricon
Copy link
Contributor

fbricon commented Dec 17, 2018

ok, will open a separate bug then

@angelozerr
Copy link
Contributor

@NikolasKomonen you are right, it's an issue with symbol provider. I must fix that, but https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/dom/DTDAttlistDecl.java#L45 must be fixed too before to support list of attributes name instead of one attribute name. If you have time to do that, it should be cool, otherwise I will see it as soon as I find time.

@fbricon
Copy link
Contributor

fbricon commented Dec 17, 2018

to follow up in #265

@NikolasKomonen
Copy link
Contributor Author

once this pr is merged I should be able to do a quickfix for #265

@angelozerr
Copy link
Contributor

once this pr is merged I should be able to do a quickfix for #265

Great! I'm waiting for your "quickfix" to fixes the outline ATTRLIST

if (stream.skipWhitespace()) {
return finishToken(offset, TokenType.Whitespace);
}

if (stream.advanceIfChar(_ORB)) { // (
nbBraceOpened++;
state = ScannerState.DTDWithinElementContent;
nbBraceOpened = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

nbBraceOpened++; seems safer, always accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this because at this point it should always equal one. Before it relied on resetting the value back to 0.

@fbricon
Copy link
Contributor

fbricon commented Dec 18, 2018

If you try to format

<!ATTRLIST name
<!ELEMENT name >

you end up with

<null
    <null>

@fbricon
Copy link
Contributor

fbricon commented Dec 18, 2018

So this is a blocker: in an empty dtd file, type <? you'll notice the running java process gets stuck on completion

Thread dump 2018-12-18 01:01:28 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.141-b15 mixed mode):

"ForkJoinPool.commonPool-worker-0" #29 daemon prio=5 os_prio=31 tid=0x00007fc67d2e9800 nid=0x100f waiting on condition [0x0000700005a87000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007bc541ab8> (a java.util.concurrent.ForkJoinPool)
at java.util.concurrent.ForkJoinPool.awaitWork(ForkJoinPool.java:1824)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1693)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

"ForkJoinPool.commonPool-worker-3" #28 daemon prio=5 os_prio=31 tid=0x00007fc67d0f0800 nid=0x5b0f runnable [0x0000700005983000]
java.lang.Thread.State: RUNNABLE
at org.eclipse.lsp4xml.dom.DOMNode.getParentElement(DOMNode.java:389)
at org.eclipse.lsp4xml.services.AbstractPositionRequest.getParentElement(AbstractPositionRequest.java:57)
at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.onTagOpen(ContentModelCompletionParticipant.java:46)
at org.eclipse.lsp4xml.services.XMLCompletions.collectOpenTagSuggestions(XMLCompletions.java:375)
at org.eclipse.lsp4xml.services.XMLCompletions.collectInsideContent(XMLCompletions.java:542)
at org.eclipse.lsp4xml.services.XMLCompletions.doComplete(XMLCompletions.java:205)
at org.eclipse.lsp4xml.services.XMLLanguageService.doComplete(XMLLanguageService.java:103)
at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$completion$1(XMLTextDocumentService.java:192)
at org.eclipse.lsp4xml.XMLTextDocumentService$$Lambda$46/2027672026.apply(Unknown Source)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

"ForkJoinPool.commonPool-worker-2" #27 daemon prio=5 os_prio=31 tid=0x00007fc67b924000 nid=0x9a0f runnable [0x0000700005880000]
java.lang.Thread.State: RUNNABLE
at org.eclipse.lsp4xml.dom.DOMNode.getParentElement(DOMNode.java:389)
at org.eclipse.lsp4xml.services.AbstractPositionRequest.getParentElement(AbstractPositionRequest.java:57)
at org.eclipse.lsp4xml.extensions.contentmodel.participants.ContentModelCompletionParticipant.onTagOpen(ContentModelCompletionParticipant.java:46)
at org.eclipse.lsp4xml.services.XMLCompletions.collectOpenTagSuggestions(XMLCompletions.java:375)
at org.eclipse.lsp4xml.services.XMLCompletions.collectInsideContent(XMLCompletions.java:542)
at org.eclipse.lsp4xml.services.XMLCompletions.doComplete(XMLCompletions.java:205)
at org.eclipse.lsp4xml.services.XMLLanguageService.doComplete(XMLLanguageService.java:103)
at org.eclipse.lsp4xml.XMLTextDocumentService.lambda$completion$1(XMLTextDocumentService.java:192)
at org.eclipse.lsp4xml.XMLTextDocumentService$$Lambda$46/2027672026.apply(Unknown Source)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

"Attach Listener" #20 daemon prio=9 os_prio=31 tid=0x00007fc67d26a800 nid=0x9d07 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"pool-2-thread-1" #16 prio=5 os_prio=31 tid=0x00007fc67b8f2800 nid=0x5903 waiting on condition [0x000070000567b000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007bc54e418> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1081)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

"DestroyJavaVM" #15 prio=5 os_prio=31 tid=0x00007fc67d002800 nid=0x1803 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"pool-3-thread-1" #14 prio=5 os_prio=31 tid=0x00007fc67b8db800 nid=0x5803 runnable [0x0000700005578000]
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
- locked <0x00000007bc582168> (a java.io.BufferedInputStream)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:79)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

"pool-4-thread-1" #13 prio=5 os_prio=31 tid=0x00007fc67c93b800 nid=0x9f03 waiting on condition [0x0000700005475000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007bc582410> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

"Service Thread" #11 daemon prio=9 os_prio=31 tid=0x00007fc67c03c800 nid=0xa203 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"C1 CompilerThread2" #10 daemon prio=9 os_prio=31 tid=0x00007fc67c03c000 nid=0xa403 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #9 daemon prio=9 os_prio=31 tid=0x00007fc67b832000 nid=0xa603 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #8 daemon prio=9 os_prio=31 tid=0x00007fc67c04d800 nid=0xa803 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"JDWP Event Helper Thread" #7 daemon prio=10 os_prio=31 tid=0x00007fc67c04c800 nid=0x5503 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"JDWP Transport Listener: dt_socket" #6 daemon prio=10 os_prio=31 tid=0x00007fc67c04c000 nid=0x3e07 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #5 daemon prio=9 os_prio=31 tid=0x00007fc67c846000 nid=0x3d03 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (Concurrent GC)" #4 daemon prio=9 os_prio=31 tid=0x00007fc67c824000 nid=0x3b03 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fc67b831800 nid=0x4603 in Object.wait() [0x0000700004a57000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007bc5832c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x00000007bc5832c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

"Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fc67b829000 nid=0x3503 in Object.wait() [0x0000700004954000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007bc583480> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x00000007bc583480> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

"VM Thread" os_prio=31 tid=0x00007fc67d02c800 nid=0x3403 runnable

"Gang worker#0 (Parallel GC Threads)" os_prio=31 tid=0x00007fc67c803800 nid=0x1e07 runnable

"Gang worker#1 (Parallel GC Threads)" os_prio=31 tid=0x00007fc67c812800 nid=0x2a03 runnable

"Gang worker#2 (Parallel GC Threads)" os_prio=31 tid=0x00007fc67c813000 nid=0x2c03 runnable

"Gang worker#3 (Parallel GC Threads)" os_prio=31 tid=0x00007fc67c814000 nid=0x5303 runnable

"G1 Main Concurrent Mark GC Thread" os_prio=31 tid=0x00007fc67b80f000 nid=0x3103 runnable

"Gang worker#0 (G1 Parallel Marking Threads)" os_prio=31 tid=0x00007fc67b810000 nid=0x4b03 runnable

"G1 Concurrent Refinement Thread#0" os_prio=31 tid=0x00007fc67b807800 nid=0x4d03 runnable

"G1 Concurrent Refinement Thread#1" os_prio=31 tid=0x00007fc67b807000 nid=0x3003 runnable

"G1 Concurrent Refinement Thread#2" os_prio=31 tid=0x00007fc67c815000 nid=0x2f03 runnable

"G1 Concurrent Refinement Thread#3" os_prio=31 tid=0x00007fc67b806000 nid=0x2e03 runnable

"G1 Concurrent Refinement Thread#4" os_prio=31 tid=0x00007fc67c814800 nid=0x2d03 runnable

"String Deduplication Thread" os_prio=31 tid=0x00007fc67c818800 nid=0x3303 runnable

"VM Periodic Task Thread" os_prio=31 tid=0x00007fc67c03d800 nid=0xa103 waiting on condition

JNI global references: 2535

@fbricon
Copy link
Contributor

fbricon commented Dec 18, 2018

threads state don't change even if you close the dtd

@angelozerr
Copy link
Contributor

So this is a blocker: in an empty dtd file, type <? you'll notice the running java process gets stuck on completion

@fbricon it was a stupid bug that it should be fixed in d55d53e

@angelozerr
Copy link
Contributor

If you try to format

It's again a problem with tolerant parser. You can see the trouble in the outline (nothing appears)

@NikolasKomonen
Copy link
Contributor Author

NikolasKomonen commented Dec 18, 2018

The provided example:

<!ATTRLIST name
<!ELEMENT name >

has 'ATTLIST' spelt wrong.

The ATTRLIST node is stored as a TextNode at the moment, that contains the start/end positions:

|<!ATTRLIST name|

I can modify this to make it work with the outline.

@angelozerr
Copy link
Contributor

The ATTRLIST node is stored as a TextNode at the moment, that contains the start/end positions:

Indeed @NikolasKomonen I have done this choice (store as DOMTextNode) the content of DTD which is not valid (to avoid loosing content when format is done even if content is not valid).

But the problem here is that this DOMText breaks the parse of <!ELEMENT. I don't know if it's possible but we should improve DTD scanner to have more tolerant support.

@NikolasKomonen
Copy link
Contributor Author

NikolasKomonen commented Dec 18, 2018

@angelozerr The parser doesnt break for this, I still get the document symbol for element and all the nodes are in DOMDocument.

Both the DOMText and DTDElementDecl nodes are present.

@NikolasKomonen NikolasKomonen force-pushed the parserDTDFix branch 2 times, most recently from e376e4a to 20cdda1 Compare December 18, 2018 22:12
Fixes eclipse-lemminx#231

Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
@NikolasKomonen
Copy link
Contributor Author

@fbricon The tests are updated.

@fbricon fbricon merged commit 8861108 into eclipse-lemminx:master Dec 19, 2018
@NikolasKomonen NikolasKomonen deleted the parserDTDFix branch January 23, 2019 19:37
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