mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-23 11:41:20 +00:00
* GSWeb/GSWApplication.m o removed unused +initialize * GSWeb/GSWDefaultAdaptorThread.m: o more information on "bad request first line" exception * GSWeb/GSWHTMLDynamicElement.m o in -initWithName:attributeAssociations:contentElements: add "" to association values because XML parser romove them. o added -computeActionStringWithActionClassAssociation: directActionNameAssociation:inContext: o added -computeQueryDictionaryWithActionClassAssociation: directActionNameAssociation:queryDictionaryAssociation: otherQueryAssociations:inContext: * GSWeb/GSWResponse.m: o don't append debugcomment if !GSDebugSet(@"debugComments") o fixed bug in appendContentString: in NSAssert3 params o adedd -_appendTagAttribute:value:escapingHTMLAttributeValue: o added GSWResponse (GSWResponseRedirected) * GSWeb/GSWResponse.h: o added -forceFinalizeInContext o added GSWResponse (GSWResponseRedirected) * GSWeb/GSWTemplateParserXML.m: o only include comments if [GSWApplication includeCommentsInResponses] * GSWExtensions.framework/GSWLongResponsePage.m: o in -cancel call cancelPageForStatus: instead of cancelPage o declare private interface * GSWeb/GSWComponent.m: o don't output end of component commend if !DEBUG && !GSDebugSet(@"gswcomponents") o fixes in _generateResponseInContext: * GSWeb/GSWContext.[hm]: o added _userInfo to enable developper context specific temporary information storage o added -userInfo o added -_generateRelativeURLs o make -_generateCompleteURLs returning previous state. o added -directActionURLForActionNamed:queryDictionary:isSecure: o added -_directActionURLForActionNamed:queryDictionary:isSecure:url: o added -componentActionURLIsSecure: o modified -session o modified -_takeAwakeComponent: to not add already added component o implemented _takeAwakeComponentsFromArray; o fixed -_incrementContextID o added _session o fixes in -copyWithZone to keep mutable objects mutables. o added _requestContextID o added -_setRequestContextID: and -_requestContextID; * GSWeb/GSWHyperlink.[hm]: o added _secure o added binding validation tests o fixes in -appendToResponse:inContext: o handle correctly otherQueryAssociations (bindings starting with '?') * GSWeb/GSWConstants.[hm]: o added cidStore__Key for GSWHTMLURLValuedElement o added cidKey__Key for GSWHTMLURLValuedElement * GSWeb/GSWImage.[hm]: o added _width, _height * GSWeb/GSWHTMLURLValuedElement.[hm] o implemented -_appendCGIActionURLToResponse:inContext: o implemented -computeActionStringInContext: o implemented -computeQueryDictionaryInContext: o handle otherQueryAssociations (bindings starting with '?') o handle cidStore and cidKey * GSWeb/GSWRequest.[hm]: o added _context o changes for compilation warnings o added -sessionIDFromValuesOrCookieByLookingForCookieFirst: o added +_lookForIDsInCookiesFirst o rewrite form/uri/cookie values retrieving (for sessionID,...) o new use GSMimeParser for formData parsing * Doc/antlr.txt added * GSWeb/GSWPageDefParser.[hm] regenerated to handle (bindings starting with '?') * GSWeb/GSWPageDefParserTokenTypes.txt regenerated to handle (bindings starting with '?') * GSWeb/GSWPageDefParserTokenTypes.h regenerated to handle (bindings starting with '?') * GSWeb/GSWPageDefLexer.[hm] regenerated to handle (bindings starting with '?') * GSWeb/GSWUtils.[hm]: o added -extractObjectsForKeysWithPrefix:removePrefix: o fixed bug in HexStringToData o fixed bug in NSDictionary +dictionaryWithArray:onSelector:withObject: * GSWeb/GSWForm.[hm] o handle otherQueryAssociations (bindings starting with '?') o implemented -computeQueryDictionaryInContext: o implemented/fixed -_appendHiddenFieldsToResponse:inContext: o implemented -_appendCGIActionToResponse:inContext: o fix -appendGSWebObjectsAssociationsToResponse:inContext: for directAction o added -computeActionStringInContext: o fixed -invokeActionForRequest:inContext: to invoke action when to element is invoked * GSWeb/GSWDirectAction.m: o fixed -_initializeRequestSessionIDInContext: o added -sessionIDForRequest: * GSWeb/NSString+HTML.[hm]: o added -dictionaryWithSep1:withSep2:withOptionUnescape:forceArray: * GSWeb/NSString+Trimming.m: o fix in +stringUniqueIdWithLength: initialize random generator * GSWeb/GSWSession.[hm]: o added createSessionID which create better sessionID (uniq in time and larger to give better security) o fixes in _saveCurrentPage * GSWeb/GSWBundle.m: o fix compiler warning git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@15630 72102866-910b-0410-8b05-ffd578937521
309 lines
7.1 KiB
Text
309 lines
7.1 KiB
Text
/*
|
|
*/
|
|
header {
|
|
#include <GSWeb/GSWeb.h>
|
|
}
|
|
|
|
options {
|
|
language="Objc";
|
|
}
|
|
|
|
class GSWPageDefParser extends Parser;
|
|
options {
|
|
/*exportVocab=GSWPageDef;*/
|
|
buildAST=true;
|
|
k = 4;
|
|
}
|
|
|
|
{
|
|
NSMutableDictionary* elements;
|
|
GSWPageDefElement* currentElement;
|
|
NSString* currentMemberName;
|
|
GSWAssociation* currentAssociation;
|
|
NSMutableArray* includes;
|
|
NSMutableArray* errors;
|
|
NSMutableArray* warnings;
|
|
}
|
|
|
|
/*
|
|
imaginaryTokenDefinitions
|
|
: INCLUDE
|
|
;
|
|
*/
|
|
|
|
document
|
|
{
|
|
DESTROY(elements);
|
|
elements=[NSMutableDictionary new];
|
|
DESTROY(includes);
|
|
includes=[NSMutableArray new];
|
|
DESTROY(errors);
|
|
DESTROY(warnings);
|
|
}
|
|
: ((object { [elements setObject:currentElement forKey:[currentElement elementName]]; } )
|
|
| (include))+
|
|
;
|
|
//TODO unescapedString
|
|
include:
|
|
(INCLUDE (WS)*)
|
|
includeObj:STRING { [includes addObject:[self unescapedString:[[[includeObj text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]]; }
|
|
;
|
|
|
|
object:
|
|
objectId:IDENT^ {currentElement=[[GSWPageDefElement new] autorelease]; [currentElement setElementName:[objectId_AST text]]; }
|
|
COLUMN^
|
|
( definition )!
|
|
;
|
|
|
|
definition:
|
|
( classname )
|
|
LCURLY^
|
|
( member { [currentElement setAssociation:currentAssociation forKey:currentMemberName]; DESTROY(currentMemberName); DESTROY(currentAssociation); })*! RCURLY!
|
|
(SEMI)?
|
|
;
|
|
classname:
|
|
objectClass:IDENT { [currentElement setClassName:[objectClass text]]; }
|
|
;
|
|
|
|
member:
|
|
memberName:mname { ASSIGN(currentMemberName,([memberName_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""])); }
|
|
ASSIGN ( mvalue )
|
|
(SEMI)*!
|
|
;
|
|
|
|
mname:
|
|
(QUESTIONMARK)? (IDENT)
|
|
;
|
|
|
|
//TODO unescapedString
|
|
mvalue:
|
|
( assocKeyPath:idref
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithKeyPath:[assocKeyPath_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
| assocConstantInt:INT
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantInt text]]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
| YES
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:YES]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
| NO
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:NO]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
| assocConstantString:STRING
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[self unescapedString:[[[assocConstantString text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
| assocConstantHexNum:HEXNUM
|
|
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantHexNum text]]];
|
|
ASSIGN(currentAssociation,assoc); }; }
|
|
)
|
|
;
|
|
|
|
idref:
|
|
(CIRC | TILDE)? (IDENT | IDENTREF ) (PIDENT | PIDENTREF)*
|
|
;
|
|
|
|
class GSWPageDefLexer extends Lexer;
|
|
options {
|
|
k = 4;
|
|
/*exportVocab=GSWPageDef;*/
|
|
charVocabulary = '\3'..'\377';
|
|
caseSensitive=true;
|
|
filter=UNDEFINED_TOKEN;
|
|
}
|
|
|
|
// Single-line comments
|
|
SL_COMMENT
|
|
: "//"
|
|
(~('\n'|'\r'))* ('\n'|'\r'('\n')?)
|
|
{ _ttype = ANTLRToken_SKIP; [self newline]; } //{$setType(Token.SKIP); newline();}
|
|
;
|
|
|
|
// multiple-line comments
|
|
ML_COMMENT
|
|
: "/*"
|
|
( /* '\r' '\n' can be matched in one alternative or by matching
|
|
'\r' in one iteration and '\n' in another. I am trying to
|
|
handle any flavor of newline that comes in, but the language
|
|
that allows both "\r\n" and "\r" and "\n" to all be valid
|
|
newline is ambiguous. Consequently, the resulting grammar
|
|
must be ambiguous. I'm shutting this warning off.
|
|
*/
|
|
options {
|
|
generateAmbigWarnings=false;
|
|
}
|
|
:
|
|
{ [self LA:2]!='/' }? '*'
|
|
| '\r' '\n' { [self newline]; } // {newline();}
|
|
| '\r' { [self newline]; } // {newline();}
|
|
| '\n' { [self newline]; } // {newline();}
|
|
| ~('*'|'\n'|'\r')
|
|
)*
|
|
"*/"
|
|
{ _ttype = ANTLRToken_SKIP; } // {$setType(Token.SKIP);}
|
|
;
|
|
|
|
|
|
/* STRUCTURAL tags
|
|
*/
|
|
|
|
INCLUDE: "#include"
|
|
;
|
|
|
|
IDENT
|
|
options { testLiterals = true; }
|
|
: (LETTER|'_') (LETTER|'_'|DIGIT)*
|
|
;
|
|
|
|
PIDENT
|
|
options { testLiterals = true; }
|
|
: POINT (IDENT | STRING)
|
|
;
|
|
|
|
IDENTREF
|
|
options { testLiterals = true; }
|
|
: (LETTER|'_'|'@') (LETTER|'_'|DIGIT)*
|
|
;
|
|
|
|
PIDENTREF
|
|
options { testLiterals = true; }
|
|
: POINT (IDENTREF | INT | STRING)
|
|
;
|
|
|
|
YES
|
|
options { testLiterals = true; }
|
|
: "YES"
|
|
;
|
|
|
|
NO
|
|
options { testLiterals = true; }
|
|
: "NO"
|
|
;
|
|
|
|
LCURLY: '{'
|
|
;
|
|
|
|
RCURLY: '}'
|
|
;
|
|
|
|
SEMI: ';'
|
|
;
|
|
|
|
CIRC: '^'
|
|
;
|
|
|
|
TILDE: '~'
|
|
;
|
|
|
|
COLUMN: ':'
|
|
;
|
|
|
|
ASSIGN: '='
|
|
;
|
|
|
|
QUESTIONMARK: '?'
|
|
;
|
|
|
|
WS:
|
|
( ' '
|
|
| '\t'
|
|
| '\n' { [self newline]; }
|
|
| "\r\n" { [self newline]; }
|
|
| '\r' { [self newline]; }
|
|
) { _ttype = ANTLRToken_SKIP; }
|
|
;
|
|
|
|
STRING
|
|
// : '"' (~'"')* '"'
|
|
// | '\'' (~'\'')* '\''
|
|
: '\'' ( ESC |~('\''|'\\'))* '\''
|
|
| '"' ( ESC |~('"'|'\\'))* '"'
|
|
;
|
|
|
|
POINT: '.';
|
|
|
|
INT : (DIGIT)+
|
|
;
|
|
|
|
HEXNUM
|
|
: '#' HEXINT
|
|
;
|
|
|
|
// escape sequence -- note that this is protected; it can only be called
|
|
// from another lexer rule -- it will not ever directly return a token to
|
|
// the parser
|
|
// There are various ambiguities hushed in this rule. The optional
|
|
// '0'...'9' digit matches should be matched here rather than letting
|
|
// them go back to STRING_LITERAL to be matched. ANTLR does the
|
|
// right thing by matching immediately; hence, it's ok to shut off
|
|
// the FOLLOW ambig warnings.
|
|
protected
|
|
ESC
|
|
: '\\'
|
|
( 'n'
|
|
| 'r'
|
|
| 't'
|
|
| 'b'
|
|
| 'f'
|
|
| '"'
|
|
| '\''
|
|
| '\\'
|
|
| ('u')+ HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT
|
|
| ('0'..'3')
|
|
(
|
|
options {
|
|
warnWhenFollowAmbig = false;
|
|
}
|
|
: ('0'..'9')
|
|
(
|
|
options {
|
|
warnWhenFollowAmbig = false;
|
|
}
|
|
: '0'..'9'
|
|
)?
|
|
)?
|
|
| ('4'..'7')
|
|
(
|
|
options {
|
|
warnWhenFollowAmbig = false;
|
|
}
|
|
: ('0'..'9')
|
|
)?
|
|
)
|
|
;
|
|
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'
|
|
;
|