[Sciviews-commits] r471 - in komodo/SciViews-K: components udl
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 1 15:07:17 CEST 2012
Author: phgrosjean
Date: 2012-05-01 15:07:17 +0200 (Tue, 01 May 2012)
New Revision: 471
Added:
komodo/SciViews-K/components/koRwiki_UDL_Language.py
komodo/SciViews-K/udl/R2wiki.udl
komodo/SciViews-K/udl/Rwiki-mainlex.udl
komodo/SciViews-K/udl/wiki2R.udl
komodo/SciViews-K/udl/wikilex.udl
Log:
Further code for wiki bock & tcltk2
Added: komodo/SciViews-K/components/koRwiki_UDL_Language.py
===================================================================
--- komodo/SciViews-K/components/koRwiki_UDL_Language.py (rev 0)
+++ komodo/SciViews-K/components/koRwiki_UDL_Language.py 2012-05-01 13:07:17 UTC (rev 471)
@@ -0,0 +1,104 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+# ActiveState Software Inc (code inspired from)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# Komodo R wiki language service
+
+import logging
+from koUDLLanguageBase import KoUDLLanguage
+from xpcom import components #, nsError, COMException, ServerException
+
+
+log = logging.getLogger("koRwikiLanguage")
+#log.setLevel(logging.DEBUG)
+
+
+def registerLanguage(registry):
+ log.debug("Registering language R wiki")
+ registry.registerLanguage(KoRwikiLanguage())
+
+
+class KoRwikiLanguage(KoUDLLanguage):
+ name = "Rwiki"
+ lexresLangName = "Rwiki"
+ _reg_desc_ = "%s Language" % name
+ _reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % name
+ _reg_clsid_ = "{7de21e4c-23d3-513c-9b31-6e8dc4ab72bf}"
+ _reg_categories_ = [("komodo-language", name)]
+ defaultExtension = '.Rwiki'
+ primary = 1
+ lang_from_udl_family = {
+ 'M': None
+ }
+
+ commentDelimiterInfo = {
+ "line": [ "#", ],
+ }
+
+ downloadURL = "http://www.sciviews.org"
+ searchURL = "http://www.rseek.org/"
+
+ variableIndicators = '$'
+ _dedenting_statements = [u'return', u'break', u'else', u'next']
+ _indenting_statements = [u'switch', u'if', u'ifelse', u'while', u'for', u'repeat']
+ supportsSmartIndent = "brace"
+
+ #styleStdin = components.interfaces.ISciMoz.SCE_C_STDIN
+ #styleStdout = components.interfaces.ISciMoz.SCE_C_STDOUT
+ #styleStderr = components.interfaces.ISciMoz.SCE_C_STDERR
+
+
+ sample = """== A h2 title
+
+A paragraph of text with **bold** //italic// text...
+
+* Item 1,
+* Item 2
+
+"""
+
+ # Overriding these base methods to work around bug 81066.
+ def get_linter(self):
+ None
+ #return self._get_linter_from_lang("R")
+ def get_interpreter(self):
+ None
+
+ #def get_lexer(self):
+ # return None
+ # if self._lexer is None:
+ # self._lexer = KoLexerLanguageService()
+ # self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP)
+ # self._lexer.setKeywords(0, lang_r.keywords)
+ # self._lexer.setKeywords(1, lang_r.builtins)
+ # self._lexer.supportsFolding = 1
+ # return self._lexer
Added: komodo/SciViews-K/udl/R2wiki.udl
===================================================================
--- komodo/SciViews-K/udl/R2wiki.udl (rev 0)
+++ komodo/SciViews-K/udl/R2wiki.udl 2012-05-01 13:07:17 UTC (rev 471)
@@ -0,0 +1,39 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+# ActiveState Software Inc (code inspired from)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# R switches to wiki block using !" at the beginning of a line
+
+family ssl
+
+state IN_SSL_DEFAULT:
+/^[!]"/ : paint(upto, SSL_DEFAULT), paint(include, M_TAGNAME) => IN_M_WIKI_START
Added: komodo/SciViews-K/udl/Rwiki-mainlex.udl
===================================================================
--- komodo/SciViews-K/udl/Rwiki-mainlex.udl (rev 0)
+++ komodo/SciViews-K/udl/Rwiki-mainlex.udl 2012-05-01 13:07:17 UTC (rev 471)
@@ -0,0 +1,58 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+# ActiveState Software Inc (code inspired from)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# UDL for R wiki files
+# To build:
+# python luddite.py compile udl/R-mainlex.udl -f --ext=.R [--guid, --skel needed]
+# python luddite.py package R -f
+# Open R_language-1.0.0-ko.xpi in Komodo, install, restart
+
+language Rwiki
+
+include "R2wiki.udl"
+include "wiki2R.udl"
+
+initial IN_M_DEFAULT
+
+include "Rlex.udl"
+include "wikilex.udl"
+
+family markup
+#sublanguage HTML # Not used
+
+#initial IN_M_DEFAULT
+
+## Need to get into a state with keywords -- use SSL
+#state IN_M_DEFAULT:
+## Transition to R wiki language: about anything...
+#/./ : paint(upto, M_DEFAULT), redo => IN_M_WIKI_START
Added: komodo/SciViews-K/udl/wiki2R.udl
===================================================================
--- komodo/SciViews-K/udl/wiki2R.udl (rev 0)
+++ komodo/SciViews-K/udl/wiki2R.udl 2012-05-01 13:07:17 UTC (rev 471)
@@ -0,0 +1,42 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+# ActiveState Software Inc (code inspired from)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# Wiki components are switch back to R using !" again at the beginning of a line
+
+family markup
+
+state in_wiki_default_start_of_line:
+/[!]"/ : paint(upto, M_CDATA), paint(include, M_TAGNAME), => IN_M_WIKI_STOP
+
+state IN_M_WIKI_STOP:
+/^/ : paint(upto, M_CDATA), => IN_SSL_DEFAULT
Added: komodo/SciViews-K/udl/wikilex.udl
===================================================================
--- komodo/SciViews-K/udl/wikilex.udl (rev 0)
+++ komodo/SciViews-K/udl/wikilex.udl 2012-05-01 13:07:17 UTC (rev 471)
@@ -0,0 +1,156 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+# ActiveState Software Inc (code inspired from)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# Lexer description for R wiki chunks
+family markup
+sublanguage Rwiki
+
+state IN_M_WIKI_START
+/^/ : => in_wiki_default_start_of_line
+/./: redo, => in_wiki_default_on_line
+
+state in_wiki_default_start_of_line:
+#'{{{' : paint(upto, M_DEFAULT), paint(include, M_TAGNAME), => in_wiki_triple_brace_start
+'#': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+'===== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+'==== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+'=== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+'== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+'= ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+'.': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
+
+# This is for the item list
+'* ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'*** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'**** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
+/./: redo, => in_wiki_default_on_line
+
+state in_wiki_finish_header:
+/$/ : paint(upto, M_PI), paint(include, M_PI), => in_wiki_default_start_of_line
+#/\s+/ : #stay
+'#': paint(upto, M_PI), paint(include, M_COMMENT), => in_wiki_have_comment
+#/./: redo, => in_wiki_default_on_line
+
+state in_wiki_default_on_line:
+'#': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+/$/: => in_wiki_default_start_of_line
+"//" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_italic
+"**" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_bold
+
+"'''''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q5
+"'''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q3
+"''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q2
+
+"~~" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_tilde2
+"^" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_caret
+
+'{{{' : paint(upto, M_CDATA), => in_wiki_brace_3
+/!'+/: #stay
+/![~^{,]+/: #stay
+/$/: => in_wiki_default_start_of_line
+
+#{{{ braces
+state in_wiki_triple_brace_start:
+/\s*\r?$/: => in_wiki_triple_brace_next_line
+/./: redo, => in_wiki_brace_3
+
+# First line after a lone "{{{" will change state.
+state in_wiki_triple_brace_next_line
+/#!python\b/: paint(include, M_OPERATOR), => IN_M_DEFAULT
+/#!html\b/: paint(include, M_OPERATOR), => IN_M_DEFAULT
+/./ : redo, => in_wiki_brace_3
+
+state in_wiki_brace_3:
+/!./: #stay
+'}}}': paint(include, M_TAGSPACE), => in_wiki_default_on_line
+#}}}
+#{{{ headers
+# bangs don't escape in headings
+#state in_wiki_h1:
+#/ =(?=[\s\r#]|$)/: paint(include, M_STRING), => in_wiki_finish_header
+#/$/ => in_tw_default_start_of_line # XXX Better to have an EOL_HEADER line
+#state in_wiki_h2:
+#/ ==(?=[\s\r#]|$)/: paint(include, M_STRING), => in_wiki_finish_header
+#/$/ => in_wiki_default_start_of_line
+#state in_wiki_h3:
+#/ ===(?=[\s\r#]|$)/: paint(include, M_STRING), => in_wiki_finish_header
+#/$/ => in_wiki_default_start_of_line
+#state in_wiki_h4:
+#/ ====(?=[\s\r#]|$)/: paint(include, M_STRING), => in_wiki_finish_header
+#/$/ => in_wiki_default_start_of_line
+#state in_wiki_h5:
+#/ =====(?=[\s\r#]|$)/: paint(include, M_STRING), => in_wiki_finish_header
+#/$/ => in_wiki_default_start_of_line
+#state in_wiki_blockheader:
+#/$/: paint(include, M_TAGNAME), => in_wiki_default_start_of_line
+
+state in_wiki_have_comment:
+# These things are actually IDs that would be part of the element.
+/$/: paint(upto, M_COMMENT), => in_wiki_default_start_of_line
+
+#}}}
+
+
+#{{{ in-line things
+state in_wiki_italic:
+/!\/+/: #stay
+## TODO: allow for other in-line things inside this!
+"//" : paint(upto, M_ATTRNAME), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
+state in_wiki_bold:
+/!\*+/: #stay
+"**" : paint(upto, M_TAGNAME), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
+state in_wiki_q5:
+/!'+/: #stay
+"'''''" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+state in_wiki_q3:
+/!'+/: #stay
+"'''" : paint(upto, SSL_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+state in_wiki_q2:
+/!'+/: #stay
+"''" : paint(upto, CSL_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
+state in_wiki_tilde2:
+/!~+/: #stay
+"~~" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+state in_wiki_caret:
+/!^/: #stay
+"^" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+#}}}
+
+#### Fold info #################################################################
+#fold '!"' M_STRING +
+#fold '!"' M_STRING -
More information about the Sciviews-commits
mailing list