Ik pak XML wel even. Die kan dan ook wel dienen als HTML/XSLT/RDF highlighter.
Als het vrij simpel gaat wil ik ook nog wel naar XPath/XQuery kijken.
Als het vrij simpel gaat wil ik ook nog wel naar XPath/XQuery kijken.
Cheatah heeft een tijdje terug de CSS highlighter gebakken; misschien kan je hem om hulp vragen?Glimi schreef op woensdag 22 juni 2005 @ 23:13:
Argh, ik word helemaal naar van het aan de praat krijgen van de code van .oisyn. Ik wacht anders wel even totdat hij terug is.
[ Voor 19% gewijzigd door crisp op 22-06-2005 23:22 ]
Intentionally left blank
[ Voor 48% gewijzigd door NMe op 22-06-2005 23:24 ]
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
Cheatah een beetje kennende heeft ie het op linux gedaan en ik zit hier te pielen met VS.NET 2003. Affijn, ik heb de boel na wat geneuzel toch aan de praat. Nu nog een lex-file schrijven en het zou moeten werken.crisp schreef op woensdag 22 juni 2005 @ 23:21:
Cheatah heeft een tijdje terug de CSS highlighter gebakken; misschien kan je hem om hulp vragen?
Overigens bevat de versie op zijn website nog een aantal bugs; als je wilt kan ik je de huidige versie wel even sturen die we hier gebruiken?
[ Voor 8% gewijzigd door Glimi op 22-06-2005 23:47 ]
Je hoeft alleen maar een .l file te schrijven miep, beetje programmeur heeft toch geen simpele compiler nodig om te controlleren of z'n code werkt ?Glimi schreef op woensdag 22 juni 2005 @ 23:47:
Cheatah een beetje kennende heeft ie het op linux gedaan en ik zit hier te pielen met VS.NET 2003. Affijn, ik heb de boel na wat geneuzel toch aan de praat. Nu nog een lex-file schrijven en het zou moeten werken.
Als je de nieuwe versie wilt sturen, graag, maar wel aub met VS.NET project files
God, root, what is difference? | Talga Vassternich | IBM zuigt
Intentionally left blank
't is wel makkelijk als je nog nooit met flex gewerkt hebtmoto-moi schreef op donderdag 23 juni 2005 @ 00:09:
Je hoeft alleen maar een .l file te schrijven miep, beetje programmeur heeft toch geen simpele compiler nodig om te controlleren of z'n code werkt ?
Ik heb laatst ff vluchtig naar de code gekeken, maar afaik is de cpp er alleen maar voor om de kleurtjes te fix0ren enzo, de intelligentie zit in de .l file, en die kun je uit de andere files wel leren volgens mijGlimi schreef op donderdag 23 juni 2005 @ 00:22:
't is wel makkelijk als je nog nooit met flex gewerkt hebtDe theorie begrijp ik wel, dus echt een probleem denk ik niet dat het wordt
[ Voor 3% gewijzigd door moto-moi op 23-06-2005 01:09 ]
God, root, what is difference? | Talga Vassternich | IBM zuigt
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| /*
Flex code for highlighting XML code
created by John van Schie / Glimi.
Parts of this code are heavily inspired by code of .oisyn
*/
%option noyywrap prefix="xml"
%x PREPROC
%{
#include "lexer.h"
#include "html.h"
#include <vector>
void eatuntil(FlexLexer * l, const char * start, const char * stop, int tokenType);
%}
ws [ \t\r\n]+
version [0-9]+\.[0-9]
q ["']
enc [a-zA-Z]([a-zA-Z0-9._]|-)*
eq {ws}?={ws}?
NameChar [A-Za-z0-9\._:-]
Name [A-Za-z_:]{NameChar}*
VersionDecl {ws}version{eq}{q}[0-9]+\.[0-9]{q}
EncodingDecl {ws}encoding{eq}{q}{enc}{q}
SDDecl {ws}standalone{eq}{q}(yes|no){q}
ExternalId ("SYSTEM"{ws}{SystemLiteral})|("PUBLIC"{ws}{PubIdLiteral}{ws}{SystemLiteral})
SystemLiteral {q}[^"]*{q}
PubIdLiteral {q}{PubIdChar}*{q}
PubIdChar [ \t\n]|[a-zA-Z0-9]|[-()+,./:=?;!*#@$_%]
XMLDecl "<?xml"{VersionDecl}?{EncodingDecl}?{SDDecl}?{ws}?"?>"
PI "<?"{Name}({ws}[^?]*[^>]*)?"?>"
DoctypeDecl "<!DOCTYPE"{ws}{Name}({ws}{ExternalId})?{ws}?("["[^\]]*"]"{ws}?)?">"
TagName {Name}
AttName {Name}
AttValue \"([^&<"]|{EntityRef})*\"
EntityRef "&"{Name}";"
StartTag "<"{TagName}
CDATASection "<![CDATA["
%%
{XMLDecl} { token( TOKEN_SPECIAL, YYText(), 0, 1 ); }
{PI} { token( TOKEN_SPECIAL, YYText(), 0, 1 ); }
{DoctypeDecl} { token( TOKEN_SPECIAL, YYText(), 0, 1 ); }
{CDATASection} eatuntil( this, "<![CDATA[", "]]>", TOKEN_NONE );
{StartTag} {
// The first char ('<') is a TOKEN_NONE
token( TOKEN_NONE, YYText(), 1, 1 );
// The name follows directly beyond the '<'
// and ends when we find whitespace or a '/'
char* name = strchr( YYText(), '<' );
++name;
int len = strcspn( name, " /" );
token( TOKEN_IDENT, name, len, 1 );
}
"</"{TagName} {
token( TOKEN_NONE, YYText(), 2, 1 );
char* name = strchr( YYText(), '/' );
token(TOKEN_IDENT, ++name, 0, 1 );
}
{EntityRef} { token( TOKEN_SPECIAL, YYText(), 0, 1 ); }
{AttName}{eq}{AttValue} {
int eq = strcspn( YYText(), " =" );
int quot = strcspn( YYText(), "\"'" );
token( TOKEN_IDENT, YYText(), eq, 1 );
token( TOKEN_NONE, YYText() + eq, quot-eq, 1 );
token( TOKEN_STRING, YYText() + quot, 0, 1 );
}
"<!--" eatcomment(this, "<!--", "-->");
.|\n { token( TOKEN_NONE, YYText(), 0, 1 ); }
%%
void eatuntil(FlexLexer * l, const char * start, const char * stop, int tokenType) {
int c;
bool stopSearch = false;
int stopLen = strlen( stop );
std::vector<char> str(start, start + strlen( start ) );
str.reserve( 1024 );
while( !stopSearch && (c = l->yyinput()) != EOF) {
str.push_back (c);
if(c == stop[0]) {
for( int i = 1; i < stopLen; ++i ) {
if((c = l->yyinput()) == stop[i]) {
str.push_back (c);
if( i == stopLen - 1 )
stopSearch = true;
} else
l->yyunput (c, const_cast<char *> (l->YYText ()));
}
}
}
if( c == stop[stopLen - 1] )
token (tokenType, &str.front (), (int)str.size (), 1);
else
token (TOKEN_ERROR, &str.front (), (int)str.size (), 1);
}
REGISTER_LEXER("xml"); |
[ Voor 18% gewijzigd door Glimi op 24-06-2005 15:13 ]
Mail hem maar ff aan mij, dan zal ik hem vanavond even gaan testenHet zal niet allemaal even netjes zijn, maar het werkt netjes op m'n testsetWie wil de file hebben om te testen?
Ach, dat heeft 'ie toch niet door[edit] Shit, zomaar vergeten te vermelden dat bepaalde delen van de code afgekeken zijn van .oisyn
God, root, what is difference? | Talga Vassternich | IBM zuigt
donemoto-moi schreef op vrijdag 24 juni 2005 @ 15:20:
Mail hem maar ff aan mij, dan zal ik hem vanavond even gaan testen
Da's jammer, aangezien ik er juist zo m'n best op heb gedaanAch, dat heeft 'ie toch niet door
1
| "<!--" eatuntil(this, "<!--", "-->", TOKEN_COMMENT); |
God, root, what is difference? | Talga Vassternich | IBM zuigt
1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
[ Voor 6% gewijzigd door moto-moi op 24-06-2005 20:44 ]
God, root, what is difference? | Talga Vassternich | IBM zuigt
1
2
3
| int double float = "m'n oma"; while( catch( int oma ){} try{ finally { private class Onzin()}); |
1
| std::cout << "Gliempo zegt dingen die niet waar zijn :'( |
God, root, what is difference? | Talga Vassternich | IBM zuigt
Omdat .oisyn daar gebruik maakt van eatstring, welke zelf (en dus niet de lexer) van de input blijft eten totdat hij een " tegenkomt (unescaped). Komt hij deze niettegen voor EOF, dan wordt het gemarked als een TOKEN_ERROR.moto-moi schreef op vrijdag 24 juni 2005 @ 22:06:
Ow ? Waarom merkt de lexer wel dat dit fout is ?
C++:
1 std::cout << "Gliempo zegt dingen die niet waar zijn :'(
1
2
3
4
5
6
| <?xml version="1.0" encoding="ISO-8859-1"?> <note> <!-- Unclosed comment <node /> <node /> </note> |
1
2
3
4
5
6
| <?xml version="1.0" encoding="ISO-8859-1"?> <note> <![CDATA[ Unclosed CDATA <node /> <node /> </note> |
Glimi schreef op vrijdag 24 juni 2005 @ 22:10:
Omdat .oisyn daar gebruik maakt van eatstring, welke zelf (en dus niet de lexer) van de input blijft eten totdat hij een " tegenkomt (unescaped). Komt hij deze niettegen voor EOF, dan wordt het gemarked als een TOKEN_ERROR.
Zou ook zo moeten zijn bij deze XML' etjes:
XML:
1 2 3 4 5 6 <?xml version="1.0" encoding="ISO-8859-1"?> <note> <!-- Unclosed comment <node /> <node /> </note>
1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
seperation
XML:
1 2 3 4 5 6 <?xml version="1.0" encoding="ISO-8859-1"?> <note> <![CDATA[ Unclosed CDATA <node /> <node /> </note>
1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
God, root, what is difference? | Talga Vassternich | IBM zuigt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
| <?xml version="1.0" encoding="UTF-8"?>
<!-- John van Schie, 0240435, xyz@cs.uu.nl -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<!-- Set the output in such a way that we can decently output XHTML
method="xml" because we do not want the META tag and because XHTML is XML
omit-xml-declaration because IE renders in quirksmode if it does not find a doctype as first statement
-->
<xsl:output indent="yes" method="xml" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<!-- Start of the process -->
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Article">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<!-- further markup is done by the CSS -->
<link rel="stylesheet" type="text/css" href="camerasInFocus.css"/>
<title><xsl:value-of select="Title" /></title>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="Author">
<h2>About the author</h2>
<address>
<xsl:value-of select="FirstName" /> <xsl:value-of select="Surname" /><br />
<xsl:value-of select="JobTitle" /><br />
<xsl:value-of select="OrgName" /><br />
<xsl:value-of select="Address/City"/>, <xsl:value-of select="Address/State"/><br />
<xsl:value-of select="Address/Country" /><br />
</address>
</xsl:template>
<xsl:template match="Sect1">
<xsl:apply-templates />
</xsl:template>
<!-- Match on the Title of the Article -->
<xsl:template match="Article/Title">
<h1><xsl:value-of select="." /></h1>
</xsl:template>
<!-- Match on the Title of the Section -->
<xsl:template match="Sect1/Title">
<h2><xsl:value-of select="." /></h2>
</xsl:template>
<!-- Match on the Title of the Subsection -->
<xsl:template match="Sect2/Title">
<h3><xsl:value-of select="." /></h3>
</xsl:template>
<xsl:template match="Para">
<p>
<xsl:apply-templates />
</p>
</xsl:template>
<!-- Do not produce <p> tags in a list, because we do not want block items there -->
<xsl:template match="ListItem/Para">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="ItemizedList">
<ul>
<xsl:apply-templates />
</ul>
</xsl:template>
<xsl:template match="ListItem">
<li><xsl:apply-templates /></li>
</xsl:template>
<xsl:template match="table">
<table>
<!-- Only if there needs to be a border, we will need a border model -->
<xsl:if test="@border">
<xsl:attribute name="style">border-collapse: collapse;</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</table>
</xsl:template>
<xsl:template match="tbody">
<tbody>
<xsl:apply-templates />
</tbody>
</xsl:template>
<xsl:template match="tr">
<tr>
<xsl:apply-templates />
</tr>
</xsl:template>
<xsl:template match="td">
<td>
<!-- Fill the style attribute with a vertical-align if set or/and a boder if set at the <table> element -->
<xsl:attribute name="style">
<xsl:if test="@valign">
vertical-align: <xsl:value-of select="@valign" />;
</xsl:if>
<xsl:variable name="border-width" select="../../../../table/@border" />
<xsl:if test="$border-width">
border: <xsl:value-of select="$border-width"/>px solid #000;
</xsl:if>
</xsl:attribute>
<xsl:apply-templates />
</td>
</xsl:template>
<xsl:template match="InlineGraphic">
<img>
<!-- src and alt are not checked because these are required XHTML attributes -->
<xsl:attribute name="src"><xsl:value-of select="@FileRef" /></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="../text()" /></xsl:attribute>
<xsl:attribute name="style">
<xsl:if test="@Width">
width: <xsl:value-of select="@Width" />px;
</xsl:if>
<xsl:if test="@Depth">
height: <xsl:value-of select="@Depth" />px;
</xsl:if>
</xsl:attribute>
</img>
</xsl:template>
<xsl:template match="Bibliography">
<h2><xsl:value-of select="Title" /></h2>
<ul>
<xsl:apply-templates select="BiblioItem"/>
</ul>
</xsl:template>
<!-- the id attribute of BiblioItem is translated to an id element of the <li> element -->
<xsl:template match="BiblioItem">
<li>
<xsl:attribute name="id"><xsl:value-of select="@Id" /></xsl:attribute>
<xsl:apply-templates />
</li>
</xsl:template>
<!-- Include the Designator in square brackets -->
<xsl:template match="Designator">
[<xsl:value-of select="." />]
</xsl:template>
<xsl:template match="BiblioEntry">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="ULink">
<a>
<xsl:attribute name="href"><xsl:value-of select="@URL"/></xsl:attribute>
<xsl:value-of select="." />
</a>
</xsl:template>
<xsl:template match="LastModDate">
<p>
This page is last modified on: <xsl:value-of select="." />
</p>
</xsl:template>
</xsl:stylesheet> |
[ Voor 24% gewijzigd door Glimi op 24-06-2005 22:23 ]
[ Voor 27% gewijzigd door Glimi op 24-06-2005 22:30 ]
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>All</to> <status>Staat online</status> </note> |
God, root, what is difference? | Talga Vassternich | IBM zuigt
1
| //topic[ title = '[feat] xml parser in progress' and topicstarter/id = 25663] |
[ Voor 21% gewijzigd door Glimi op 29-06-2005 14:31 ]
God, root, what is difference? | Talga Vassternich | IBM zuigt
Dit topic is gesloten.
![]()
Apple iPhone 17 LG OLED evo G5 Google Pixel 10 Samsung Galaxy S25 Star Wars: Outlaws Nintendo Switch 2 Apple AirPods Pro (2e generatie) Sony PlayStation 5 Pro
Tweakers is onderdeel van
DPG Media B.V.
Alle rechten voorbehouden - Auteursrecht © 1998 - 2025
•
Hosting door TrueFullstaq