"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/scala_ref_scala_lang_org.lua" (12 May 2020, 10473 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "scala_ref_scala_lang_org.lua": 3.53_vs_3.54.

    1 --[[
    2 Sample plugin file for highlight 3.9
    3 
    4 -- to be finished---
    5 ]]
    6 
    7 Description="Add scala-lang.org reference links to HTML, LaTeX, RTF and ODT output of Scala code"
    8 
    9 Categories = {"scala", "html", "rtf", "latex", "odt" }
   10 
   11 -- optional parameter: syntax description
   12 function syntaxUpdate(desc)
   13 
   14   if desc~="Scala" then
   15     return
   16   end
   17 
   18   function Set (list)
   19     local set = {}
   20     for _, l in ipairs(list) do set[l] = true end
   21       return set
   22   end
   23 
   24   scala_items = Set
   25   { "Any","AnyRef","AnyVal","App","Application","Array","Boolean","Byte","Cell",
   26     "Char","cloneable","Console","CountedIterator","DelayedInit","deprecated",
   27     "deprecatedName","Double","Dynamic","Either","Enumeration","Equals",
   28     "FallbackArrayBuilding","Float","Function","Function1","Function2","Immutable",
   29     "inline","Int","Left","Long","LowPriorityImplicits","MatchError","Math",
   30     "Mutable","native","noinline","None","NotDefinedError","Nothing","NotNull",
   31     "Null","Option","PartialFunction","Predef","Product","Product1","Product2",
   32     "Proxy","remote","Responder","Right","Serializable","SerialVersionUID","Short",
   33     "Some","specialized","Symbol","throws","transient","Tuple1","Tuple2","unchecked",
   34     "UninitializedError","UninitializedFieldError","Unit","volatile" }
   35 
   36 
   37   actor_items = Set
   38   { "AbstractActor","Actor","CanReply","Channel","DaemonActor","Debug","Exit",
   39     "Future","Futures","InputChannel","IScheduler","MessageQueue",
   40     "MessageQueueElement","OutputChannel","Reaction","Reactor","ReplyReactor",
   41     "Scheduler","SchedulerAdapter","TIMEOUT","UncaughtException" }
   42 
   43   remote_items = Set
   44   { "ExitFun","FreshNameCreator","JavaSerializer","LinkToFun","LocalApply0",
   45     "Locator","NamedSend","Node","RemoteActor","RemoteApply0","SendTo","Serializer",
   46     "Service","TcpService","Terminate","UnlinkFromFun" }
   47 
   48   actors_scheduler_items = Set
   49   { "ActorGC","DaemonScheduler","ExecutorScheduler","ForkJoinScheduler",
   50     "ResizableThreadPoolScheduler","SingleThreadedScheduler" }
   51 
   52   annotation_items = Set
   53   { "Annotation","ClassfileAnnotation","elidable","implicitNotFound","serializable",
   54     "StaticAnnotation","strictfp","switch","tailrec","TypeConstraint","varargs" }
   55 
   56   annotation_target_items = Set
   57   { "beanGetter","beanSetter","field","getter","param","setter" }
   58 
   59 
   60   annotation_unchecked_items= Set
   61   { "uncheckedStable","uncheckedVariance" }
   62 
   63 
   64   collection_items= Set
   65   { "BitSet","BitSetLike","BufferedIterator","CustomParallelizable","DefaultMap",
   66     "GenIterable","GenIterableLike","GenIterableView","GenIterableViewLike","GenMap",
   67     "GenMapLike","GenSeq","GenSeqLike","GenSeqView","GenSeqViewLike","GenSet",
   68     "GenSetLike","GenTraversable","GenTraversableLike","GenTraversableOnce",
   69     "GenTraversableView","GenTraversableViewLike","IndexedSeq","IndexedSeqLike",
   70     "IndexedSeqOptimized","Iterable","IterableLike","IterableProxy",
   71     "IterableProxyLike","IterableView","IterableViewLike","Iterator",
   72     "JavaConversions","JavaConverters","LinearSeq","LinearSeqLike",
   73     "LinearSeqOptimized","Map","MapLike","MapProxy","MapProxyLike","Parallel",
   74     "Parallelizable","Seq","SeqLike","SeqProxy","SeqProxyLike","SeqView",
   75     "SeqViewLike","Set","SetLike","SetProxy","SetProxyLike","SortedMap",
   76     "SortedMapLike","SortedSet","SortedSetLike","Traversable","TraversableLike",
   77     "TraversableOnce","TraversableProxy","TraversableProxyLike","TraversableView",
   78     "TraversableViewLike","ViewMkString","focushide" }
   79 
   80 
   81   collection_generic_items= Set
   82   { "Addable","AtomicIndexFlag","BitSetFactory","CanBuildFrom","CanCombineFrom",
   83     "ClassManifestTraversableFactory","DefaultSignalling","DelegatedContext",
   84     "DelegatedSignalling","FilterMonadic","GenericClassManifestCompanion",
   85     "GenericClassManifestTraversableTemplate","GenericCompanion",
   86     "GenericOrderedCompanion","GenericOrderedTraversableTemplate",
   87     "GenericParCompanion","GenericParMapCompanion","GenericParMapTemplate",
   88     "GenericParTemplate","GenericSeqCompanion","GenericSetTemplate",
   89     "GenericTraversableTemplate","GenMapFactory","GenSeqFactory","GenSetFactory",
   90     "GenTraversableFactory","Growable","HasNewBuilder","HasNewCombiner",
   91     "IdleSignalling","ImmutableMapFactory","ImmutableSetFactory",
   92     "ImmutableSortedMapFactory","ImmutableSortedSetFactory","IterableForwarder",
   93     "MapFactory","MutableMapFactory","MutableSetFactory","OrderedTraversableFactory",
   94     "ParFactory","ParMapFactory","ParSetFactory","SeqFactory","SeqForwarder",
   95     "SetFactory","Shrinkable","Signalling","Sizing","SliceInterval","Sorted",
   96     "SortedMapFactory","SortedSetFactory","Subtractable","TaggedDelegatedContext",
   97     "TraversableFactory","TraversableForwarder","VolatileAbort" }
   98 
   99   collection_immutable_items= Set
  100   { "BitSet","DefaultMap","HashMap","HashSet","IndexedSeq","IntMap","Iterable",
  101     "LinearSeq","List","ListMap","ListSet","LongMap","Map","MapLike","MapProxy",
  102     "Nil","NumericRange","RangeUtils","PagedSeq","Queue","Range","RedBlack","Seq",
  103     "Set","SetProxy","SortedMap","SortedSet","Stack","Stream","StreamIterator",
  104     "StreamView","StreamViewLike","StringLike","StringOps","Traversable","TreeMap",
  105     "TreeSet","Vector","VectorBuilder","VectorIterator","WrappedString" }
  106 
  107 
  108   collection_interfaces_items= Set
  109   { "IterableMethods","MapMethods","SeqMethods","SetMethods","SubtractableMethods",
  110     "TraversableMethods","TraversableOnceMethods" }
  111 
  112 
  113   collection_mutable_items= Set
  114   { "AddingBuilder","ArrayBuffer","ArrayBuilder","ArrayLike","ArrayOps","ArraySeq",
  115     "ArrayStack","BitSet","Buffer","BufferLike","BufferProxy","Builder","Cloneable",
  116     "ConcurrentMap","DefaultEntry","DefaultMapModel","DoubleLinkedList",
  117     "DoubleLinkedListLike","FlatHashTable","GrowingBuilder","HashEntry","HashMap",
  118     "HashSet","HashTable","History","ImmutableMapAdaptor","ImmutableSetAdaptor",
  119     "IndexedSeq","IndexedSeqLike","IndexedSeqOptimized","IndexedSeqView","Iterable",
  120     "LazyBuilder","LinearSeq","LinkedEntry","LinkedHashMap","LinkedHashSet",
  121     "LinkedList","LinkedListLike","ListBuffer","ListMap","Map","MapBuilder",
  122     "MapLike","MapProxy","MultiMap","MutableList","ObservableBuffer","ObservableMap",
  123     "ObservableSet","OpenHashMap","PriorityQueue","PriorityQueueProxy","Publisher",
  124     "Queue","QueueProxy","ResizableArray","RevertibleHistory","Seq","SeqLike","Set",
  125     "SetBuilder","SetLike","SetProxy","Stack","StackProxy","StringBuilder",
  126     "Subscriber","SynchronizedBuffer","SynchronizedMap","SynchronizedPriorityQueue",
  127     "SynchronizedQueue","SynchronizedSet","SynchronizedStack","Traversable",
  128     "Undoable","UnrolledBuffer","WeakHashMap","WrappedArray","WrappedArrayBuilder" }
  129 
  130 
  131   collection_parallel_items= Set
  132   { "AdaptiveWorkStealingForkJoinTasks","AdaptiveWorkStealingTasks",
  133     "AdaptiveWorkStealingThreadPoolTasks","Combiner","ForkJoinTasks",
  134     "FutureThreadPoolTasks","HavingForkJoinPool","IterableSplitter",
  135     "CompositeThrowable","FactoryOps","ThrowableOps","TraversableOps","ParIterable",
  136     "ParIterableLike","ParIterableView","ParIterableViewLike","ParMap","ParMapLike",
  137     "ParSeq","ParSeqLike","ParSeqView","ParSeqViewLike","ParSet","ParSetLike",
  138     "PreciseSplitter","SeqSplitter","Splitter","Tasks","TaskSupport",
  139     "ThreadPoolTasks" }
  140 
  141 
  142   collection_parallel_immutable_items= Set
  143   { "Builder","HashSetCombiner","ParHashMap","ParHashSet","ParIterable","ParMap",
  144     "ParRange","ParSeq","ParSet","ParVector" }
  145 
  146   collection_parallel_mutable_items= Set
  147   { "LazyCombiner","ParArray","ParFlatHashTable","ParHashMap","ParHashSet",
  148     "ParHashTable","ParIterable","ParMap","ParMapLike","ParSeq","ParSet",
  149     "ParSetLike","ResizableParArrayCombiner","UnrolledParArrayCombiner" }
  150 
  151   function getURL(token, cat)
  152     url='http://www.scala-lang.org/api/current/scala/'..cat..'/'..token.. '.html'
  153 
  154     if (HL_OUTPUT== HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
  155       return '<a class="hl" target="new" href="' .. url .. '">'.. token .. '</a>'
  156     elseif (HL_OUTPUT == HL_FORMAT_LATEX) then
  157       return '\\href{'..url..'}{'..token..'}'
  158     elseif (HL_OUTPUT == HL_FORMAT_RTF) then
  159       return '{{\\field{\\*\\fldinst HYPERLINK "'..url..'" }{\\fldrslt\\ul\\ulc0 '..token..'}}}'
  160     elseif (HL_OUTPUT == HL_FORMAT_ODT) then
  161       return '<text:a xlink:type="simple" xlink:href="'..url..'">'..token..'</text:a>'
  162     end
  163   end
  164 
  165 
  166   function Decorate(token, state)
  167 
  168     if (state ~= HL_STANDARD and state ~= HL_KEYWORD) then
  169       return
  170     end
  171 
  172     if scala_items[token] then
  173       return getURL(token, '')
  174     elseif  actor_items[token] then
  175       return getURL(token, 'actors')
  176     elseif  remote_items[token] then
  177       return getURL(token, 'remote')
  178     elseif  actors_scheduler_items[token] then
  179       return getURL(token, 'actors/scheduler')
  180     elseif  annotation_items[token] then
  181       return getURL(token, 'annotation')
  182     elseif  annotation_target_items[token] then
  183       return getURL(token, 'annotation/target')
  184     elseif  annotation_unchecked_items[token] then
  185       return getURL(token, 'annotation/unchecked')
  186     elseif  collection_items[token] then
  187       return getURL(token, 'collection')
  188     elseif  collection_generic_items[token] then
  189       return getURL(token, 'collection/generic')
  190     elseif  collection_immutable_items[token] then
  191       return getURL(token, 'collection/immutable')
  192     elseif  collection_interfaces_items[token] then
  193       return getURL(token, 'collection/interfaces')
  194     elseif  collection_mutable_items[token] then
  195       return getURL(token, 'collection/mutable')
  196     elseif  collection_parallel_items[token] then
  197       return getURL(token, 'collection/parallel')
  198     elseif  collection_parallel_immutable_items[token] then
  199       return getURL(token, 'collection/parallel/immutable')
  200     elseif  collection_parallel_mutable_items[token] then
  201       return getURL(token, 'collection/parallel/mutable')
  202     end
  203 
  204   end
  205 end
  206 
  207 function themeUpdate(desc)
  208   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
  209     Injections[#Injections+1]="a.hl, a.hl:visited {color:inherit;font-weight:inherit;}"
  210   elseif (HL_OUTPUT==HL_FORMAT_LATEX) then
  211     Injections[#Injections+1]="\\usepackage[colorlinks=false, pdfborderstyle={/S/U/W 1}]{hyperref}"
  212   end
  213 end
  214 
  215 --The Plugins array assigns code chunks to themes or language definitions.
  216 --The chunks are interpreted after the theme or lang file were parsed,
  217 --so you can refer to elements of these files
  218 
  219 Plugins={
  220 
  221   { Type="lang", Chunk=syntaxUpdate },
  222   { Type="theme", Chunk=themeUpdate },
  223 
  224 }