Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a lexer for the Slice language.
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Printer.ice | ||
module Demo | ||
{ | ||
interface Printer | ||
{ | ||
// A client can invoke this operation on a server. | ||
// In this example we print the string s | ||
void printString(string s); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- # | ||
# frozen_string_literal: true | ||
|
||
module Rouge | ||
module Lexers | ||
load_lexer 'c.rb' | ||
|
||
class Slice < C | ||
tag 'slice' | ||
filenames '*.ice' | ||
mimetypes 'text/slice' | ||
|
||
title "Slice" | ||
desc "Specification Language for Ice (doc.zeroc.com)" | ||
|
||
def self.keywords | ||
@keywords ||= Set.new %w( | ||
extends implements enum interface struct class module dictionary | ||
const optional out throws exception local idempotent sequence | ||
|
||
Object LocalObject Value | ||
) | ||
end | ||
|
||
def self.keywords_type | ||
@keywords_type ||= Set.new %w( | ||
bool string byte long float double int void short | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- # | ||
# frozen_string_literal: true | ||
|
||
describe Rouge::Lexers::Slice do | ||
let(:subject) { Rouge::Lexers::Slice.new } | ||
|
||
describe 'guessing' do | ||
include Support::Guessing | ||
|
||
it 'guesses by filename' do | ||
assert_guess :filename => 'foo.ice' | ||
end | ||
|
||
it 'guesses by mimetype' do | ||
assert_guess :mimetype => 'text/slice' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// File system module. | ||
module Filesystem { | ||
|
||
// Node interface: | ||
interface Node { | ||
idempotent string name(); | ||
} | ||
|
||
exception GenericError { | ||
string reason; | ||
} | ||
|
||
sequence<string> Lines; | ||
|
||
["java:implements:java.lang.AutoCloseable"] | ||
interface File extends Node { | ||
idempotent Lines read(); | ||
idempotent void write(Lines text) throws GenericError; | ||
} | ||
|
||
sequence<Node*> NodeSeq; | ||
|
||
// Directory interface: | ||
interface Directory extends Node { | ||
idempotent NodeSeq list(); | ||
} | ||
} |