Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slice interface language support #867

Merged
merged 9 commits into from Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/rouge/demos/slice
@@ -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);
}
}
32 changes: 32 additions & 0 deletions lib/rouge/lexers/slice.rb
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

jolkdarr marked this conversation as resolved.
Show resolved Hide resolved
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
18 changes: 18 additions & 0 deletions spec/lexers/slice_spec.rb
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

jolkdarr marked this conversation as resolved.
Show resolved Hide resolved
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
27 changes: 27 additions & 0 deletions spec/visual/samples/slice
@@ -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();
}
}