Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Update efault values.
Browse files Browse the repository at this point in the history
Add missing attribute (lineBeginContext) in Syntax::context.
  • Loading branch information
pasnox committed Aug 17, 2012
1 parent e333702 commit 77acbba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/syntax/SyntaxContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Syntax::ContextData : public QSharedData
public:
QString name;
QString attribute;
QString lineBeginContext;
QString lineEndContext;
bool fallThrough;
QString fallThroughContext;
Expand All @@ -15,7 +16,11 @@ class Syntax::ContextData : public QSharedData

ContextData()
: QSharedData(),
attribute( "normal" ),
lineBeginContext( "#stay" ),
lineEndContext( "#stay" ),
fallThrough( false ),
fallThroughContext( "#stay" ),
dynamic( false ),
noIndentationBasedFolding( false ),
caseSensitive( false )
Expand All @@ -26,6 +31,7 @@ class Syntax::ContextData : public QSharedData
: QSharedData( other ),
SYNTAX_OTHER_INIT( name ),
SYNTAX_OTHER_INIT( attribute ),
SYNTAX_OTHER_INIT( lineBeginContext ),
SYNTAX_OTHER_INIT( lineEndContext ),
SYNTAX_OTHER_INIT( fallThrough ),
SYNTAX_OTHER_INIT( fallThroughContext ),
Expand Down Expand Up @@ -56,6 +62,7 @@ Syntax::Context::~Context()

SYNTAX_IMPL_MEMBER( QString, name, Context )
SYNTAX_IMPL_MEMBER( QString, attribute, Context )
SYNTAX_IMPL_MEMBER( QString, lineBeginContext, Context )
SYNTAX_IMPL_MEMBER( QString, lineEndContext, Context )
SYNTAX_IMPL_MEMBER( bool, fallThrough, Context )
SYNTAX_IMPL_MEMBER( QString, fallThroughContext, Context )
Expand Down
1 change: 1 addition & 0 deletions src/syntax/SyntaxContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Context

SYNTAX_DECL_MEMBER( QString, name ); ///< Name of the context
SYNTAX_DECL_MEMBER( QString, attribute );
SYNTAX_DECL_MEMBER( QString, lineBeginContext );
SYNTAX_DECL_MEMBER( QString, lineEndContext );
SYNTAX_DECL_MEMBER( bool, fallThrough );
SYNTAX_DECL_MEMBER( QString, fallThroughContext );
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/SyntaxDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Syntax::DocumentData : public QSharedData
}
};

QString Syntax::DocumentData::globalDefaultDeliminator( " \t.():!+,-<=>%&*/;?[]^{|}~\\" );
QString Syntax::DocumentData::globalDefaultDeliminator( ".():!+,-<=>%&*/;?[]^{|}~\\ \t" );


Syntax::Document::Document()
Expand Down
7 changes: 7 additions & 0 deletions src/syntax/SyntaxParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ bool Syntax::Parser::startElement( const QString& namespaceURI, const QString& l
d->contextName = atts.value( i );
context.name() = d->contextName;
}
else if ( QodeEdit::stringEquals( name, "lineBeginContext" ) ) {
context.lineBeginContext() = atts.value( i );
}
else if ( QodeEdit::stringEquals( name, "lineEndContext" ) ) {
context.lineEndContext() = atts.value( i );
}
Expand Down Expand Up @@ -309,6 +312,10 @@ bool Syntax::Parser::startElement( const QString& namespaceURI, const QString& l
}
}

if ( !context.fallThrough() ) {
context.fallThroughContext().clear();
}

d->document->highlighting().contexts()[ context.name() ] = context;

if ( d->document->highlighting().defaultContext().isEmpty() ) {
Expand Down

0 comments on commit 77acbba

Please sign in to comment.