mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-21 02:41:04 +00:00
ADDITIONAL_INCLUDE_DIRS and ADDITIONAL_LIB_DIRS. * Testing/DynamicElements/Makefile.preamble: Ditto. * GSWExtensionsGSW.framework/Makefile.preamble: Ditto. Also remove comments. * GSWeb.framework/Makefile.preamble.in: Ditto. Also correct ADDITIONAL_CPPFLAGS * Testing/DynamicElements/GNUmakefile: Remove unused variables. * GSWeb.framework/GNUmakefile: Ditto. * GSWExtensions.framework/Makefile.postamble: Removed unused targets 'regenerate' and 'copy-dist'. * GSWExtensionsGSW.framework/Makefile.postamble: Ditto. * Testing/DynamicElements/Makefile.postamble: Ditto. * GSWeb.framework/Makefile.postamble: Ditto. Add rule for GNUSTEP_TARGET_DIR dependent 'config.h'. * Testing/DynamicElements/Resources/Info-DynamicElements.plist: Correct spelling. * Testing/DynamicElements/DynamicElements.m: Replace #import with #include. * Testing/DynamicElements/DynamicElements_main.m: Ditto. * Testing/DynamicElements/Main.h: Ditto. * Testing/DynamicElements/Main.m: Ditto. * Examples/hello/Hello.m: Ditto. * Examples/hello/HelloPage.h: Ditto. * Examples/hello/HelloPage.m: Ditto. * Examples/hello/Hello_main.m: Ditto. * Examples/hello/Main.h: Ditto. * Examples/hello/Main.m: Ditto. * Examples/hello/Resources/Info-Hello.plist: Reformatted. * GSWeb.framework/GSWDebug.h/m (GSWLogAssertGoodFn): Adjust prototype to use id instead of NSObject * and dereference via class_pointer instead of isa. ([NSObject isa]): Remove obsolete category. * GSWeb.framework/GSWPageDefLexer.h: Use "GSWeb.h" instead of <GSWeb/GSWeb.h> for include. * GSWeb.framework/GSWPageDefLexer.m: Ditto. * GSWeb.framework/GSWPageDefParser.h: Ditto. * GSWeb.framework/GSWPageDefParser.m: Ditto. * GSWeb.framework/GSWPageDefParserTokenTypes.h: Ditto. * GSWeb.framework/PageDef.g: Ditto. * GSWeb.framework/html.g: Ditto. * GSWeb.framework/htmltag.g: Ditto. * GSWeb.framework/GSWWOCompatibility.m: Remove file. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18338 72102866-910b-0410-8b05-ffd578937521
142 lines
2.9 KiB
Text
142 lines
2.9 KiB
Text
/*
|
|
*/
|
|
header {
|
|
#include "GSWeb.h"
|
|
}
|
|
|
|
options {
|
|
language="Objc";
|
|
}
|
|
|
|
class GSWHTMLAttrParser extends Parser;
|
|
options {
|
|
exportVocab=GSWHTMLAttr;
|
|
buildAST=true;
|
|
k = 2;
|
|
}
|
|
{
|
|
NSString* tagName;
|
|
NSMutableDictionary* attributes;
|
|
NSString* currentAttrName; //no retain
|
|
id currentValue; //no retain
|
|
NSMutableArray* errors;
|
|
NSMutableArray* warnings;
|
|
}
|
|
tag
|
|
{
|
|
DESTROY(attributes);
|
|
DESTROY(tagName);
|
|
DESTROY(errors);
|
|
DESTROY(warnings);
|
|
attributes=[NSMutableDictionary new];
|
|
}
|
|
: tagNameLocal:IDENT { NSDebugMLLog(@"template",@"tagNameLocal:%@",[tagNameLocal_AST text]); ASSIGN(tagName,[tagNameLocal_AST text]); NSDebugMLLog(@"template",@"Found tagName=[%@]",tagName); }
|
|
(((WS)* (attr))*)?
|
|
;
|
|
|
|
attr:
|
|
attrName:IDENT { DESTROY(currentValue); currentAttrName=[[attrName text]lowercaseString];
|
|
NSDebugMLLog(@"template",@"Found currentAttrName=[%@]",currentAttrName);
|
|
}
|
|
((WS)*)?
|
|
(ASSIGN ((WS)*)? ( mvalue ))? { NSDebugMLLog(@"template",@"Add currentValue=[%@]",currentValue); [attributes setObject:currentValue forKey:currentAttrName]; }
|
|
;
|
|
|
|
mvalue:
|
|
( intValue:INT
|
|
{ ASSIGN(currentValue,[NSNumber valueFromString:[intValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
|
|
| stringValue:STRING
|
|
{ ASSIGN(currentValue,[stringValue text]);
|
|
if ([currentValue isQuotedWith:@"\""])
|
|
{
|
|
ASSIGN(currentValue,[currentValue stringWithoutQuote:@"\""]);
|
|
};
|
|
NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
|
|
}
|
|
| hexNumValue:HEXNUM
|
|
{ ASSIGN(currentValue,[NSNumber valueFromString:[hexNumValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
|
|
| pcValue:INTPC
|
|
{ ASSIGN(currentValue,[pcValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
|
|
| identValue:IDENT
|
|
{ ASSIGN(currentValue,[identValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
|
|
)
|
|
;
|
|
|
|
class GSWHTMLAttrLexer extends Lexer;
|
|
options {
|
|
k = 8;
|
|
exportVocab=GSWHTMLAttr;
|
|
charVocabulary = '\3'..'\377';
|
|
caseSensitive=true;
|
|
filter=UNDEFINED_TOKEN;
|
|
}
|
|
|
|
|
|
/* STRUCTURAL tags
|
|
*/
|
|
|
|
IDENT
|
|
options { testLiterals = true; }
|
|
: (LETTER|'_')(LETTER|'_'|'-'|DIGIT)*
|
|
;
|
|
|
|
ASSIGN: '='
|
|
;
|
|
|
|
WS: ( ' ' | '\t' | '\n' | "\r\n" | '\r' )
|
|
;
|
|
|
|
STRING
|
|
: '"' (~'"')* '"'
|
|
| '\'' (~'\'')* '\''
|
|
;
|
|
|
|
POINT: '.';
|
|
|
|
INT : (DIGIT)+
|
|
;
|
|
|
|
PCINT : (DIGIT)+ '%'
|
|
;
|
|
|
|
HEXNUM
|
|
: '#' HEXINT
|
|
;
|
|
|
|
protected
|
|
HEXINT
|
|
: (
|
|
/* Technically, HEXINT cannot be followed by a..f, but due to our
|
|
loose grammar, the whitespace that normally would follow this
|
|
rule is optional. ANTLR reports that #4FACE could parse as
|
|
HEXINT "#4" followed by WORD "FACE", which is clearly bogus.
|
|
ANTLR does the right thing by consuming a much input as
|
|
possible here. I shut the warning off.
|
|
*/
|
|
options {
|
|
generateAmbigWarnings=false;
|
|
}
|
|
: HEXDIGIT
|
|
)+
|
|
;
|
|
|
|
protected
|
|
DIGIT
|
|
: '0'..'9'
|
|
;
|
|
|
|
protected
|
|
HEXDIGIT
|
|
: ('0'..'9'|'A'..'F'|'a'..'f')
|
|
;
|
|
|
|
protected
|
|
LCLETTER
|
|
: 'a'..'z'
|
|
;
|
|
|
|
protected
|
|
LETTER
|
|
: 'a'..'z'
|
|
| 'A'..'Z'
|
|
;
|