1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

91 Commits

Author SHA1 Message Date
Jonas Fonseca
4d248638be Remove empty first lines; a remnant from when CVS Id tags was in play 2006-12-09 22:54:22 +01:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Jonas Fonseca
a983603863 DOM: Rename src/dom/dom.h src/dom/code.h
Additionally, add API doc mark.
2006-01-31 23:30:55 +01:00
Jonas Fonseca
92a9cafb6e DOM: Replace various DOM status/error/exception codes with dom_code enum
Replaces sgml_parser_code, dom_stack_code, and dom_exception_code and
generally tries to simplify things and remove redundant codes.
2006-01-31 22:01:35 +01:00
Jonas Fonseca
f8a86a26c4 DOM: Add simple stack context based utility for dumping DOM trees to SGML 2006-01-30 06:07:16 +01:00
Jonas Fonseca
a3dcc7d5e5 DOM: Change the attribute node's quoted member to be unsigned char
It can hold NUL, ', or " depending on not quoted, single quoted or double
quoted.
2006-01-30 06:05:32 +01:00
Jonas Fonseca
9fe0608bd2 DOM: Fix checking of out-of-bound access to scanned strings 2006-01-29 12:12:41 +01:00
Jonas Fonseca
2918e3f595 DOM: Add STATIC_DOM_STRING macro and make INIT_DOM_STRING cleaner 2006-01-28 22:55:15 +01:00
Jonas Fonseca
b6b6d3c67e DOM: Allocate all node strings when doing incremental rendering
This changes init_dom_node_() to take an allocated argument saying whether
to allocate or not. If the value is -1, node->allocated will be set to the
value of node->parent->allocated. This way the value is inherited like we
do it in the menu code. It should be a sane default since we eventually
want not to rely on the 'underlying' source of the document and there will
be less variables to pass around.
2006-01-28 04:51:25 +01:00
Jonas Fonseca
95c1de2315 Fix handling of incomplete processing instructions
When doing incremental rendering we now require the whole thing to be there
and that there is room for two tokens in the scanner token table.  This is
necessary because we have to generate both a processing target token and a
processing data token to make life simpler for the parser.

Remove processing instruction data case label from the main parser loop. It
is safer this way since it already assumes that the processing target token
has been stored.
2006-01-28 03:35:36 +01:00
Jonas Fonseca
823c594524 Use ssize_t instead of size_t for length since it must carry a signed value 2006-01-28 03:24:16 +01:00
Jonas Fonseca
00c4e0bfa2 Do not attempt to read *string when string == scanner->end
There might be other places that needs to be reviewd for this.
2006-01-28 03:23:06 +01:00
Jonas Fonseca
d92a074e40 Fix parsing of '<a< b>' where the scanner didn't rewind to the proper place
Add test for this tag soup combo.
2006-01-28 03:21:27 +01:00
Jonas Fonseca
e5e06764c4 Improve checks for incompleteness when parsing attributes
Check whether there are '=' and value tokens before handling them. If there
is any doubt the whole attribute structure is 'pushed back' into the
stream. That way incremental parsing will not add the value as a new
attribute because the name token was handled in the previous parsing run.
2006-01-28 01:40:56 +01:00
Jonas Fonseca
4ab1dde874 Preserve the scanner state when it is not the 'default' state
This is necessary to make it possible to resume parsing of element
attributes. Allows the incomplete string in the parsing state struct to
be unset.
2006-01-28 01:24:30 +01:00
Jonas Fonseca
c6e83d1d9c Assert parsing depth >= parser stack depth
Like the comment says popping parsing nodes during incremental parsing
might trigger this.
2006-01-28 01:12:03 +01:00
Jonas Fonseca
9e7b0d4fa3 Remove assertion logic from parse_sgml_attributes()
They are getting out of hand and making it hard to use the function in
'unusual' situations (like when resuming parsing inside elements).
2006-01-28 01:09:05 +01:00
Jonas Fonseca
1e104afbba Improve error checking when adding nodes
Fail with SGML_PARSER_CODE_MEM_ALLOC.
2006-01-28 01:05:42 +01:00
Jonas Fonseca
74728cab05 Also set the node subtype for <?xml-stylesheet?> 2006-01-28 01:00:28 +01:00
Jonas Fonseca
bccf5512d6 Force an incomplete token for quoted attribute values when there's no end 2006-01-28 00:56:48 +01:00
Jonas Fonseca
b25cd27232 Add support incremental parsing
That is, add the last parts that saves and resumes previous incomplete
parsing states. Now the parsing stack push handler checks if the parent has
a resume flag set. When set, the incomplete fragment to resume is restored
and the new source fragment appended and parsing is continued.
2006-01-27 07:47:17 +01:00
Jonas Fonseca
9d91994f3c Propone updating the scanner->state until incompleteness has been checked
That way the scanner state is meaningful when resuming during incremental
parsing.
2006-01-27 07:41:42 +01:00
Jonas Fonseca
afb45aace5 Add support for scanning comment endings such as '--!>' correctly 2006-01-25 18:18:01 +01:00
Jonas Fonseca
126ae8c764 #include dom/node.h instead of dom/stack.h 2006-01-19 04:50:10 +01:00
Jonas Fonseca
eecc22751d Use dom_stack_code enum for dom_stack_callback_T 2006-01-16 00:55:58 +01:00
Jonas Fonseca
4a2cde1c00 Introduce dom_stack_code enum and use it for push_dom_node() 2006-01-16 00:40:51 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Jonas Fonseca
c8aa6c2360 Move struct sgml_parsing_state near the parsing state managing 2006-01-14 12:11:35 +01:00
Jonas Fonseca
e70b779366 Add code member to struct sgml_parser and simplify parsing state setup
parse_sgml() now just pushes a text node on the parsing state and the push
handler will now call parse_sgml_plain() and save the return code in
parser->code so parse_sgml() can return it. Much simpler.
2006-01-14 12:09:17 +01:00
Jonas Fonseca
0950996dd8 Change parse_sgml() to take buf+bufsize instead of DOM string 2006-01-14 11:32:11 +01:00
Jonas Fonseca
aecfb28711 Cleanup SGML info backends #includes and description 2006-01-14 08:07:00 +01:00
Laurent MONIN
5685221512 Trim trailing whitespaces. 2006-01-13 00:11:39 +01:00
Jonas Fonseca
2d80258f72 Mark doc'd headers with: /* API Doc :: <api-name> */ 2006-01-11 11:03:59 +01:00
Jonas Fonseca
938c8a80b4 Support more implicit markup of source files 2006-01-09 11:01:36 +01:00
Jonas Fonseca
db11b6452f Fix a typo and a ref:[] 2006-01-09 01:20:03 +01:00
Jonas Fonseca
5b818b20ba Use the new asciidoc code markup to document the DOM sgml parser 2006-01-08 23:36:07 +01:00
Jonas Fonseca
acb1f7e74d Refactor computation of scanner error string length to get_sgml_error_end() 2006-01-07 23:51:19 +01:00
Jonas Fonseca
534a16fff1 Improve error detection 2006-01-07 23:40:21 +01:00
Jonas Fonseca
3835bf8449 A handful of fixes related to error detection
- Fix assertion failure by breaking the switch if an error token is next
   when previous was a processing instruction.
 - Fix <!notation parsing by skipping ident chars instead of spaces.
 - Improve checking of processing instruction 'target'-end and what error
   string is generated.
 - For now put all of the processing instruction data in the error token.
 - Remove a DBG()-print.
2006-01-07 05:18:43 +01:00
Jonas Fonseca
c993a0012e Add basic support for detection errors while scanning
It mostly uses the checking for incompleteness already in place. Tested
lightly so it will definately need some more work.
2006-01-07 04:26:08 +01:00
Jonas Fonseca
5defc48eb3 Add basic support for requesting error detection; SGML scanner part missing 2006-01-07 04:21:39 +01:00
Jonas Fonseca
7ff2cb2607 Improve a comment a bit 2006-01-07 01:41:07 +01:00
Jonas Fonseca
7c65c06b41 Move up enum sgml_parser_code declaration 2006-01-07 01:29:44 +01:00
Jonas Fonseca
f8d44ffe32 scan_sgml_tokens(): Drop local variable and use scanner->current
... so lower level scanners can change the next token to use.
2006-01-07 01:25:42 +01:00
Laurent MONIN
31c30864e0 Trim trailing whitespaces. 2006-01-04 18:08:48 +01:00
Jonas Fonseca
0bfb1d7742 Free nodes created on the SGML parsing stack 2006-01-04 00:29:10 +01:00
Jonas Fonseca
66cf866ab6 Cleanup the DOM stack flags; s/KEEP_NODES/FREE_NODES/ 2006-01-03 20:35:32 +01:00
Jonas Fonseca
f75ccffbc7 Fix SGML parsing and scanning so that all tests succeeds
This includes checking the return token of get_next_dom_scanner_token() and
fixing the calculated size of recovered processing instruction data tokens.
2006-01-02 21:04:51 +01:00
Jonas Fonseca
e78d43f1ac Add mode where the SGML scanner checks for completeness 2006-01-02 17:46:09 +01:00
Jonas Fonseca
af72dd8435 Make parse_sgml() return the sgml_parser_code enum
It is mostly just ignored for now. The SGML parser test tool will however
return parser code.
2006-01-02 17:40:42 +01:00