text:
package ru.shutoff.caralarm;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
import org.joda.time.LocalTime;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;
import java.util.Vector;

public class EventsActivity extends ActionBarActivity {

    final static String EVENTS = "http://api.car-online.ru/v2?get=events&skey=$1&begin=$2&end=$3&content=json";
    final static String EVENT_GPS = "http://api.car-online.ru/v2?get=gps&skey=$1&id=$2&time=$3&content=json";
    final static String EVENT_GSM = "http://api.car-online.ru/v2?get=gsm&skey=$1&id=$2&time=$3&content=json";
    final static String SECTOR_GSM = "http://api.car-online.ru/v2?get=gsmsector&skey=$1&cc=$2&nc=$3&lac=$4&cid=$5&content=json";

    CaldroidFragment dialogCaldroidFragment;
    LocalDate current;
    ListView lvEvents;
    TextView tvNoEvents;
    View progress;

    SharedPreferences preferences;
    String api_key;

    Vector<Event> events;
    Vector<Event> filtered;

    String car_id;

    boolean loaded;
    int filter;
    boolean error;
    long current_item;

    static final String FILTER = "filter";

    static class EventType {
        EventType(int type_, int string_, int icon_) {
            type = type_;
            string = string_;
            icon = icon_;
            filter = 4;
        }

        EventType(int type_, int string_, int icon_, int filter_) {
            type = type_;
            string = string_;
            icon = icon_;
            filter = filter_;
        }

        int type;
        int string;
        int icon;
        int filter;
    }

    static EventType[] event_types = {
            new EventType(1, R.string.light_shock, R.drawable.light_shock, 0),
            new EventType(2, R.string.ext_zone, R.drawable.ext_zone, 0),
            new EventType(3, R.string.heavy_shock, R.drawable.heavy_shock, 0),
            new EventType(4, R.string.inner_zone, R.drawable.inner_zone, 0),
            new EventType(5, R.string.trunk_open, R.drawable.boot_open, 2),
            new EventType(6, R.string.hood_open, R.drawable.e_hood_open, 2),
            new EventType(7, R.string.door_open, R.drawable.door_open, 2),
            new EventType(8, R.string.tilt, R.drawable.tilt, 0),
            new EventType(9, R.string.ignition_on, R.drawable.ignition_on, 2),
            new EventType(10, R.string.access_on, R.drawable.access_on, 2),
            new EventType(11, R.string.input1_on, R.drawable.input1_on, 2),
            new EventType(12, R.string.input2_on, R.drawable.input2_on, 2),
            new EventType(13, R.string.input3_on, R.drawable.input3_on, 2),
            new EventType(14, R.string.input4_on, R.drawable.input4_on, 2),
            new EventType(15, R.string.trunk_close, R.drawable.boot_close, 2),
            new EventType(16, R.string.hood_close, R.drawable.e_hood_close, 2),
            new EventType(17, R.string.door_close, R.drawable.door_close, 2),
            new EventType(18, R.string.ignition_off, R.drawable.ignition_off, 2),
            new EventType(19, R.string.access_off, R.drawable.access_off, 2),
            new EventType(20, R.string.input1_off, R.drawable.input1_off, 2),
            new EventType(21, R.string.input2_off, R.drawable.input2_off, 2),
            new EventType(22, R.string.input3_off, R.drawable.input3_off, 2),
            new EventType(23, R.string.input4_off, R.drawable.input4_off, 2),
            new EventType(24, R.string.guard_on, R.drawable.guard_on, 1),
            new EventType(25, R.string.guard_off, R.drawable.guard_off, 1),
            new EventType(26, R.string.reset, R.drawable.reset),
            new EventType(27, R.string.main_power_on, R.drawable.main_power_off, 0),
            new EventType(28, R.string.main_power_off, R.drawable.main_power_off, 0),
            new EventType(29, R.string.reserve_power_on, R.drawable.reserve_power_off, 0),
            new EventType(30, R.string.reserve_power_off, R.drawable.reserve_power_off, 0),
            new EventType(31, R.string.gsm_recover, R.drawable.gsm_recover),
            new EventType(32, R.string.gsm_fail, R.drawable.gsm_fail),
            new EventType(34, R.string.gps_recover, R.drawable.gps_recover),
            new EventType(35, R.string.gps_fail, R.drawable.gps_fail),
            new EventType(37, R.string.trace_start, R.drawable.trace_start),
            new EventType(38, R.string.trace_stop, R.drawable.trace_stop),
            new EventType(42, R.string.user_call, R.drawable.user_call, 1),
            new EventType(43, R.string.rogue, R.drawable.rogue, 0),
            new EventType(44, R.string.rogue_off, R.drawable.rogue, 0),
            new EventType(46, R.string.motor_start, R.drawable.motor_start, 1),
            new EventType(47, R.string.motor_stop, R.drawable.motor_stop, 1),
            new EventType(48, R.string.motor_start_error, R.drawable.motor_start_error, 1),
            new EventType(49, R.string.alarm_boot, R.drawable.alarm_boot, 0),
            new EventType(50, R.string.alarm_hood, R.drawable.alarm_hood, 0),
            new EventType(51, R.string.alarm_door, R.drawable.alarm_door, 0),
            new EventType(52, R.string.ignition_lock, R.drawable.ignition_lock, 0),
            new EventType(53, R.string.alarm_accessories, R.drawable.alarm_accessories, 0),
            new EventType(54, R.string.alarm_input1, R.drawable.alarm_input1, 0),
            new EventType(55, R.string.alarm_input2, R.drawable.alarm_input2, 0),
            new EventType(56, R.string.alarm_input3, R.drawable.alarm_input3, 0),
            new EventType(57, R.string.alarm_input4, R.drawable.alarm_input4, 0),
            new EventType(59, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(60, R.string.gprs_on, R.drawable.gprs_on),
            new EventType(61, R.string.gprs_off, R.drawable.gprs_off),
            new EventType(65, R.string.reset, R.drawable.reset),
            new EventType(68, R.string.net_error, R.drawable.system),
            new EventType(72, R.string.net_error, R.drawable.system),
            new EventType(74, R.string.error_read, R.drawable.system),
            new EventType(75, R.string.net_error, R.drawable.system),
            new EventType(76, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(77, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(78, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(79, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(80, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(85, R.string.sos, R.drawable.sos, 0),
            new EventType(86, R.string.zone_in, R.drawable.zone_in),
            new EventType(87, R.string.zone_out, R.drawable.zone_out),
            new EventType(88, R.string.incomming_sms, R.drawable.user_sms, 1),
            new EventType(89, R.string.request_photo, R.drawable.request_photo, 1),
            new EventType(90, R.string.till_start, R.drawable.till_start),
            new EventType(91, R.string.end_move, R.drawable.system),
            new EventType(100, R.string.reset, R.drawable.reset),
            new EventType(101, R.string.reset, R.drawable.reset),
            new EventType(105, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(106, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(107, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(108, R.string.reset_modem, R.drawable.reset_modem),
            new EventType(110, R.string.valet_off, R.drawable.valet_off, 1),
            new EventType(111, R.string.lock_off1, R.drawable.lockclose01, 1),
            new EventType(112, R.string.lock_off2, R.drawable.lockclose02, 1),
            new EventType(113, R.string.lock_off3, R.drawable.lockclose03, 1),
            new EventType(114, R.string.lock_off4, R.drawable.lockclose04, 1),
            new EventType(115, R.string.lock_off5, R.drawable.lockclose05, 1),
            new EventType(120, R.string.valet_on, R.drawable.valet_on, 1),
            new EventType(121, R.string.lock_on1, R.drawable.lockcopen01, 1),
            new EventType(122, R.string.lock_on2, R.drawable.lockcopen02, 1),
            new EventType(123, R.string.lock_on3, R.drawable.lockcopen03, 1),
            new EventType(124, R.string.lock_on4, R.drawable.lockcopen04, 1),
            new EventType(125, R.string.lock_on5, R.drawable.lockcopen05, 1),
            new EventType(128, R.string.input5_on, R.drawable.input5_on, 2),
            new EventType(129, R.string.input5_off, R.drawable.input5_off, 2),
            new EventType(130, R.string.voice, R.drawable.voice),
            new EventType(131, R.string.download_events, R.drawable.settings),
            new EventType(132, R.string.can_on, R.drawable.can, 1),
            new EventType(133, R.string.can_off, R.drawable.can, 1),
            new EventType(134, R.string.input6_on, R.drawable.input6_on, 2),
            new EventType(135, R.string.input6_off, R.drawable.input6_off, 2),
            new EventType(136, R.string.low_battery, R.drawable.system, 0),
            new EventType(137, R.string.download_settings, R.drawable.settings),
            new EventType(138, R.string.guard2_on, R.drawable.guard_on, 1),
            new EventType(139, R.string.guard2_off, R.drawable.guard_off, 1),
            new EventType(140, R.string.lan_change, R.drawable.system, 0),
            new EventType(141, R.string.command, R.drawable.system, 1),
            new EventType(142, R.string.brake, R.drawable.brake, 2),
            new EventType(293, R.string.sos, R.drawable.sos, 0),
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.events);
        car_id = getIntent().getStringExtra(Names.ID);
        if (car_id == null)
            car_id = "";
        lvEvents = (ListView) findViewById(R.id.events);
        lvEvents.setClickable(true);
        final Context context = this;
        lvEvents.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (current_item == position) {
                    Event e = filtered.get(position);
                    if (e.point == null)
                        return;
                    LocalTime time = new LocalTime(e.time);
                    String info = "" + time.toString("H:mm:ss") + " ";
                    boolean found = false;
                    for (EventType et : event_types) {
                        if (et.type == e.type) {
                            found = true;
                            info += getString(et.string);
                        }
                    }
                    if (!found)
                        info += getString(R.string.event) + " #" + e.type;
                    info += "
";
                    Intent i = new Intent(context, MapView.class);
                    String[] point = e.point.split(";");
                    String point_data = ";" + point[0] + ";" + point[1] + ";" + e.course + ";" + info + e.address.replace("\n", "
");
                    if (point.length > 2)
                        point_data += ";" + point[2];
                    i.putExtra(Names.POINT_DATA, point_data);
                    i.putExtra(Names.ID, car_id);
                    startActivity(i);
                    return;
                }
                current_item = position;
                EventsAdapter adapter = (EventsAdapter) lvEvents.getAdapter();
                adapter.notifyDataSetChanged();
                if (preferences.getString(Names.LATITUDE + car_id, "").equals("")) {
                    new GsmEventRequest(filtered.get(position).id, filtered.get(position).time);
                } else {
                    new GpsEventRequest(filtered.get(position).id, filtered.get(position).time);
                }
            }
        });
        tvNoEvents = (TextView) findViewById(R.id.no_events);
        progress = findViewById(R.id.progress);
        preferences = PreferenceManager.getDefaultSharedPreferences(this);
        api_key = preferences.getString(Names.CAR_KEY + car_id, "");
        events = new Vector<Event>();
        filtered = new Vector<Event>();
        filter = preferences.getInt(FILTER, 3);
        setupButton(R.id.actions, 1);
        setupButton(R.id.contacts, 2);
        setupButton(R.id.system, 4);
        current = new LocalDate();
        if (savedInstanceState != null)
            current = new LocalDate(savedInstanceState.getLong(Names.TRACK_DATE));
        DataFetcher fetcher = new DataFetcher();
        fetcher.update(current);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        if (current != null)
            outState.putLong(Names.TRACK_DATE, current.toDate().getTime());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.tracks, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.day: {
                dialogCaldroidFragment = new CaldroidFragment() {

                    @Override
                    public void onAttach(Activity activity) {
                        super.onAttach(activity);
                        CaldroidListener listener = new CaldroidListener() {

                            @Override
                            public void onSelectDate(Date date, View view) {
                                changeDate(date);
                            }
                        };

                        dialogCaldroidFragment = this;
                        setCaldroidListener(listener);
                    }

                };
                Bundle args = new Bundle();
                args.putString(CaldroidFragment.DIALOG_TITLE, getString(R.string.day));
                args.putInt(CaldroidFragment.MONTH, current.getMonthOfYear());
                args.putInt(CaldroidFragment.YEAR, current.getYear());
                args.putInt(CaldroidFragment.START_DAY_OF_WEEK, 1);
                dialogCaldroidFragment.setArguments(args);
                LocalDateTime now = new LocalDateTime();
                dialogCaldroidFragment.setMaxDate(now.toDate());
                Date sel = current.toDate();
                dialogCaldroidFragment.setSelectedDates(sel, sel);
                dialogCaldroidFragment.show(getSupportFragmentManager(), "TAG");
                break;
            }
        }
        return false;
    }

    void changeDate(Date date) {
        LocalDate d = new LocalDate(date);
        dialogCaldroidFragment.dismiss();
        dialogCaldroidFragment = null;
        progress.setVisibility(View.VISIBLE);
        lvEvents.setVisibility(View.GONE);
        tvNoEvents.setVisibility(View.GONE);
        DataFetcher fetcher = new DataFetcher();
        fetcher.update(d);
    }

    void showError() {
        this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                tvNoEvents.setText(getString(R.string.error_load));
                tvNoEvents.setVisibility(View.VISIBLE);
                progress.setVisibility(View.GONE);
                error = true;
            }
        });
    }

    class DataFetcher extends HttpTask {

        LocalDate date;

        @Override
        void result(JSONObject data) throws JSONException {
            if (!current.equals(date))
                return;
            JSONArray res = data.getJSONArray("events");
            for (int i = 0; i < res.length(); i++) {
                JSONObject event = res.getJSONObject(i);
                int type = event.getInt("eventType");
                if ((type == 94) || (type == 98) || (type == 41) || (type == 33) || (type == 39) || (type == 127))
                    continue;
                long time = event.getLong("eventTime");
                long id = event.getLong("eventId");
                Event e = new Event();
                e.type = type;
                e.time = time;
                e.id = id;
                events.add(e);
            }
            loaded = true;
            filterEvents();
            progress.setVisibility(View.GONE);
        }

        @Override
        void error() {
            showError();
        }

        void update(LocalDate d) {
            setTitle(d.toString("d MMMM"));
            date = d;
            current = d;
            DateTime start = date.toDateTime(new LocalTime(0, 0));
            LocalDate next = date.plusDays(1);
            DateTime finish = next.toDateTime(new LocalTime(0, 0));
            events.clear();
            error = false;
            loaded = false;
            execute(EVENTS,
                    api_key,
                    start.toDate().getTime() + "",
                    finish.toDate().getTime() + "");
        }
    }

    class EventsAdapter extends BaseAdapter {

        @Override
        public int getCount() {
            return filtered.size();
        }

        @Override
        public Object getItem(int position) {
            return filtered.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater inflater = (LayoutInflater) getBaseContext()
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = inflater.inflate(R.layout.event_item, null);
            }
            Event e = filtered.get(position);
            TextView tvName = (TextView) v.findViewById(R.id.name);
            TextView tvTime = (TextView) v.findViewById(R.id.time);
            ImageView icon = (ImageView) v.findViewById(R.id.icon);
            LocalTime time = new LocalTime(e.time);
            tvTime.setText(time.toString("H:mm:ss"));
            boolean found = false;
            for (EventType et : event_types) {
                if (et.type == e.type) {
                    found = true;
                    tvName.setText(getString(et.string));
                    icon.setVisibility(View.VISIBLE);
                    icon.setImageResource(et.icon);
                }
            }
            if (!found) {
                tvName.setText(getString(R.string.event) + " #" + e.type);
                icon.setVisibility(View.GONE);
            }
            View progress = v.findViewById(R.id.progress);
            TextView tvAddress = (TextView) v.findViewById(R.id.address);
            if (position == current_item) {
                if (e.address == null) {
                    progress.setVisibility(View.VISIBLE);
                    tvAddress.setVisibility(View.GONE);
                } else {
                    tvAddress.setText(e.address);
                    progress.setVisibility(View.GONE);
                    tvAddress.setVisibility(View.VISIBLE);
                }
            } else {
                progress.setVisibility(View.GONE);
                tvAddress.setVisibility(View.GONE);
            }
            return v;
        }
    }

    void setupButton(int id, int mask) {
        Button btn = (Button) findViewById(id);
        if ((mask & filter) != 0)
            btn.setBackgroundResource(R.drawable.pressed);
        btn.setTag(mask);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                toggleButton(v);
            }
        });
    }

    void toggleButton(View v) {
        Button btn = (Button) v;
        int mask = (Integer) btn.getTag();
        if ((filter & mask) == 0) {
            filter |= mask;
            btn.setBackgroundResource(R.drawable.pressed);
        } else {
            filter &= ~mask;
            btn.setBackgroundResource(R.drawable.button);
        }
        SharedPreferences.Editor ed = preferences.edit();
        ed.putInt(FILTER, filter);
        ed.commit();
        if (!error)
            filterEvents();
    }

    void filterEvents() {
        filtered.clear();
        for (Event e : events) {
            if (isShow(e.type))
                filtered.add(e);
        }
        if (!loaded)
            return;
        if (filtered.size() > 0) {
            current_item = -1;
            lvEvents.setAdapter(new EventsAdapter());
            lvEvents.setVisibility(View.VISIBLE);
            tvNoEvents.setVisibility(View.GONE);
        } else {
            tvNoEvents.setText(getString(R.string.no_events));
            tvNoEvents.setVisibility(View.VISIBLE);
            lvEvents.setVisibility(View.GONE);
        }
    }

    boolean isShow(int type) {
        for (EventType et : event_types) {
            if (et.type == type) {
                if (et.filter == 0)
                    return true;
                return (et.filter & filter) != 0;
            }
        }
        return (filter & 4) != 0;
    }

    static class Event {
        int type;
        long time;
        long id;
        String point;
        String course;
        String address;
    }

    abstract class EventRequest extends HttpTask {

        long event_id;
        long event_time;

        EventRequest(long id, long time) {
            event_id = id;
            event_time = time;
        }

        @Override
        void error() {
            setAddress(getString(R.string.error_load), null, null);
        }

        void setAddress(String result, String point, String course) {
            if (current_item < 0)
                return;
            Event e = filtered.get((int) current_item);
            if ((e.id != event_id) || (e.time != event_time))
                return;
            e.address = result;
            e.point = point;
            e.course = course;
            EventsAdapter adapter = (EventsAdapter) lvEvents.getAdapter();
            adapter.notifyDataSetChanged();
        }
    }

    class GpsEventRequest extends EventRequest {

        GpsEventRequest(long id, long time) {
            super(id, time);
            execute(EVENT_GPS, api_key, id + "", time + "");
        }

        @Override
        void result(JSONObject res) throws JSONException {
            final double lat = res.getDouble("latitude");
            final double lng = res.getDouble("longitude");
            final String course = res.getString("course");
            AddressRequest request = new AddressRequest() {
                @Override
                void addressResult(String[] parts) {
                    String addr = lat + "," + lng;
                    if (parts != null) {
                        addr += "\n" + parts[0];
                        for (int i = 1; i < parts.length - 1; i++) {
                            addr += ", " + parts[i];
                        }
                    }
                    setAddress(addr, lat + ";" + lng, course);
                }
            };
            request.getAddress(preferences, lat + "", lng + "");
        }

    }

    class GsmEventRequest extends EventRequest {

        GsmEventRequest(long id, long time) {
            super(id, time);
            execute(EVENT_GSM, api_key, id + "", time + "");
        }

        @Override
        void result(JSONObject res) throws JSONException {
            int cc = res.getInt("cc");
            int nc = res.getInt("nc");
            int cid = res.getInt("cid");
            int lac = res.getInt("lac");
            String gsm = cc + " " + nc + " " + lac + " " + cid;
            if (gsm.equals(preferences.getString(Names.GSM + car_id, ""))
                    && !preferences.getString(Names.GSM_ZONE + car_id, "").equals("")) {
                setAddress(preferences.getString(Names.ADDRESS + car_id, ""), preferences.getString(Names.GSM_ZONE + car_id, ""), null);
                return;
            }
            new GsmSectorRequest(event_id, event_time, gsm);
        }

    }

    class GsmSectorRequest extends EventRequest {

        GsmSectorRequest(long id, long time, String gsm) {
            super(id, time);
            String[] p = gsm.split(" ");
            execute(SECTOR_GSM, api_key, p[0], p[1], p[2], p[3]);
        }

        @Override
        void result(JSONObject res) throws JSONException {
            JSONArray arr = res.getJSONArray("gps");
            if (arr.length() == 0)
                return;
            double max_lat = -180;
            double min_lat = 180;
            double max_lon = -180;
            double min_lon = 180;
            Vector<FetchService.Point> P = new Vector<FetchService.Point>();
            for (int i = 0; i < arr.length(); i++) {
                JSONObject point = arr.getJSONObject(i);
                try {
                    FetchService.Point p = new FetchService.Point();
                    p.x = point.getDouble("latitude");
                    p.y = point.getDouble("longitude");
                    if (p.x > max_lat)
                        max_lat = p.x;
                    if (p.x < min_lat)
                        min_lat = p.x;
                    if (p.y > max_lon)
                        max_lon = p.y;
                    if (p.y < min_lon)
                        min_lon = p.y;
                    P.add(p);
                } catch (Exception ex) {
                    ex.printStackTrace();
                    // ignore
                }
            }
            final double lat = (min_lat + max_lat) / 2;
            final double lon = (min_lon + max_lon) / 2;
            final String sector = FetchService.convexHull(P);
            AddressRequest request = new AddressRequest() {
                @Override
                void addressResult(String[] parts) {
                    String addr = lat + "," + lon;
                    if (parts != null) {
                        addr += "\n" + parts[0];
                        for (int i = 1; i < parts.length - 1; i++) {
                            addr += ", " + parts[i];
                        }
                    }
                    setAddress(addr, lat + ";" + lon + ";" + sector, null);
                }
            };
            request.getAddress(preferences, lat + "", lon + "");
        }
    }

}


text:
import unittest
import macostools
import Carbon.File
import MacOS
import os
from test import test_support
import struct
import applesingle

AS_MAGIC=0x00051600
AS_VERSION=0x00020000
dataforkdata = 'hello\r\0world\n'
resourceforkdata = 'goodbye\ncruel\0world\r'

applesingledata = struct.pack(">ll16sh", AS_MAGIC, AS_VERSION, "foo", 2) + \
    struct.pack(">llllll", 1, 50, len(dataforkdata),
        2, 50+len(dataforkdata), len(resourceforkdata)) + \
    dataforkdata + \
    resourceforkdata
TESTFN2 = test_support.TESTFN + '2'

class TestApplesingle(unittest.TestCase):

    def setUp(self):
        fp = open(test_support.TESTFN, 'w')
        fp.write(applesingledata)
        fp.close()

    def tearDown(self):
        try:
            os.unlink(test_support.TESTFN)
        except:
            pass
        try:
            os.unlink(TESTFN2)
        except:
            pass

    def compareData(self, isrf, data):
        if isrf:
            fp = MacOS.openrf(TESTFN2, '*rb')
        else:
            fp = open(TESTFN2, 'rb')
        filedata = fp.read(1000)
        self.assertEqual(data, filedata)

    def test_applesingle(self):
        try:
            os.unlink(TESTFN2)
        except:
            pass
        applesingle.decode(test_support.TESTFN, TESTFN2)
        self.compareData(False, dataforkdata)
        self.compareData(True, resourceforkdata)

    def test_applesingle_resonly(self):
        try:
            os.unlink(TESTFN2)
        except:
            pass
        applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True)
        self.compareData(False, resourceforkdata)

def test_main():
    test_support.run_unittest(TestApplesingle)

if __name__ == '__main__':
    test_main()

redpajama_set_name: RedPajamaGithub


text:
@implementation VENAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [VENExperimentsManager startExperimentsManagerWithPlistName:@"experiments"];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {

}

- (void)applicationDidEnterBackground:(UIApplication *)application {

}

- (void)applicationWillEnterForeground:(UIApplication *)application {

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

}

- (void)applicationWillTerminate:(UIApplication *)application {

}

@end


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 14-sep-2013 7:16:38 by Hibernate Tools 4.0.0 -->
<hibernate-mapping>
    <class name="com.intranet.bean.ProfesorDTO" table="profesor" catalog="bdintranete">
        <id name="idProfesor" type="int">
            <column name="idProfesor" />
            <generator class="identity" />
        </id>
        <many-to-one name="usuarioDTO" class="com.intranet.bean.UsuarioDTO" fetch="select">
            <column name="idUsuario" not-null="true" />
        </many-to-one>
        <many-to-one name="personaDTO" class="com.intranet.bean.PersonaDTO" fetch="select">
            <column name="idPersona" not-null="true" />
        </many-to-one>
        <property name="descProfesor" type="string">
            <column name="descProfesor" length="45" />
        </property>
        <set name="cursoCompuestoDTOs" table="cursocompuesto" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="idProfesor" not-null="true" />
            </key>
            <one-to-many class="com.intranet.bean.CursoCompuestoDTO" />
        </set>
    </class>
</hibernate-mapping>


text:
package com.webfirmframework.wffweb.tag.html;

import java.util.logging.Logger;

import com.webfirmframework.wffweb.settings.WffConfiguration;
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
import com.webfirmframework.wffweb.tag.html.core.PreIndexedTagName;
import com.webfirmframework.wffweb.tag.html.identifier.GlobalAttributable;
import com.webfirmframework.wffweb.tag.html.identifier.HtmlAttributable;

/**
 * @author WFF
 * @since 1.0.0
 * @version 1.0.0
 *
 */
public class Html extends DocType {

    private static final long serialVersionUID = 1_0_0L;

    private static final Logger LOGGER = Logger.getLogger(Html.class.getName());

    private static final PreIndexedTagName PRE_INDEXED_TAG_NAME;

    static {

        PRE_INDEXED_TAG_NAME = (PreIndexedTagName.HTML);

    }

    {

        init();
    }

    /**
     * Represents the root of an HTML or XHTML document. All other tags must be
     * descendants of this tag in case of building a complete HTML document. All
     * tags can also be used independently i.e. without being a child of this tag.
     *
     * @param base       i.e. parent tag of this tag
     * @param attributes An array of {@code AbstractAttribute}
     *
     * @author WFF
     * @since 1.0.0
     */
    public Html(final AbstractHtml base, final AbstractAttribute... attributes) {
        super(PRE_INDEXED_TAG_NAME, base, attributes);
        if (WffConfiguration.isDirectionWarningOn()) {
            warnForUnsupportedAttributes(attributes);
        }
    }

    private static void warnForUnsupportedAttributes(final AbstractAttribute... attributes) {
        for (final AbstractAttribute abstractAttribute : attributes) {
            if (!(abstractAttribute != null && (abstractAttribute instanceof HtmlAttributable
                    || abstractAttribute instanceof GlobalAttributable))) {
                LOGGER.warning(abstractAttribute + " is not an instance of HtmlAttribute");
            }
        }
    }

    /**
     * constructor for testing
     *
     * @since 1.0.0
     * @deprecated this constructor is used for testing purpose, it should not be
     *             used/consumed for development because it may be removed later.
     */
    // TODO should be removed later
    @Deprecated
    protected Html(final int id, final AbstractHtml base, final AbstractAttribute... attributes) {
        // this is just for testing purpose so not indexing
        super(Html.class.getSimpleName().toLowerCase() + String.valueOf(id), base, attributes);
    }

    /**
     * invokes only once per object
     *
     * @author WFF
     * @since 1.0.0
     */
    protected void init() {
        // to override and use this method
    }

    @Override
    public Html clone() throws CloneNotSupportedException {
        return (Html) super.clone();
    }
}


text:
'use strict';

import Modes = require('vs/editor/common/modes');
import modesUtil = require('vs/editor/test/common/modesUtil');
import * as lessTokenTypes from 'vs/languages/less/common/lessTokenTypes';
import {MockModeService} from 'vs/editor/test/common/mocks/mockModeService';
import {NULL_THREAD_SERVICE} from 'vs/platform/test/common/nullThreadService';
import {IThreadService} from 'vs/platform/thread/common/thread';
import {IModeService} from 'vs/editor/common/services/modeService';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {InstantiationService} from 'vs/platform/instantiation/common/instantiationService';
import {LESSMode} from 'vs/languages/less/common/less';
import {MockTokenizingMode} from 'vs/editor/test/common/mocks/mockMode';

class LESSMockModeService extends MockModeService {
	isRegisteredMode(mimetypeOrModeId: string): boolean {
		if (mimetypeOrModeId === 'javascript') {
			return true;
		}
		throw new Error('Not implemented');
	}

	getMode(commaSeparatedMimetypesOrCommaSeparatedIds: string): Modes.IMode {
		if (commaSeparatedMimetypesOrCommaSeparatedIds === 'javascript') {
			return new MockTokenizingMode('js', 'mock-js');
		}
		throw new Error('Not implemented');
	}

	getModeIdForLanguageName(alias:string): string {
		if (alias === 'text/javascript') {
			return 'javascript';
		}
		throw new Error('Not implemented');
	}
}

suite('LESS-tokenization', () => {

	let tokenizationSupport: Modes.ITokenizationSupport;
	let assertOnEnter: modesUtil.IOnEnterAsserter;

	(function() {
		let threadService = NULL_THREAD_SERVICE;
		let modeService = new LESSMockModeService();
		let services = new ServiceCollection();
		services.set(IThreadService, threadService);
		services.set(IModeService, modeService);
		let inst = new InstantiationService(services);
		threadService.setInstantiationService(inst);

		let mode = new LESSMode(
			{ id: 'less' },
			inst,
			threadService,
			modeService,
			null,
			null
		);

		tokenizationSupport = mode.tokenizationSupport;
		assertOnEnter = modesUtil.createOnEnterAsserter(mode.getId(), mode.richEditSupport);
	})();

	test('', () => {
		modesUtil.executeTests(tokenizationSupport, [
			// Keywords
			[{
			line: 'isnumber(10);',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 8, type: 'punctuation.parenthesis.less' },
				{ startIndex: 9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex: 11, type: 'punctuation.parenthesis.less' },
				{ startIndex: 12, type: 'punctuation.less' }
			]}],
			[{
			line: 'iskeyword(@test) ;mix',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 9, type: 'punctuation.parenthesis.less'},
				{ startIndex: 10, type: 'variable.less' },
				{ startIndex: 15, type: 'punctuation.parenthesis.less' },
				{ startIndex: 16, type: '' },
				{ startIndex: 17, type: 'punctuation.less' },
				{ startIndex: 18, type: 'keyword.less' }
			]}],

			[{
			line: 'whenn',
			tokens: [
				{ startIndex: 0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
			]}],

			[{
			line: '    round    ',
			tokens: [
				{ startIndex: 0, type: '' },
				{ startIndex: 4, type: 'keyword.less' },
				{ startIndex: 9, type: '' }
			]}],

			// Units
			[{
			line: 'isnumber(10px);',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 8, type: 'punctuation.parenthesis.less' },
				{ startIndex: 9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex: 11, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex: 13, type: 'punctuation.parenthesis.less' },
				{ startIndex: 14, type: 'punctuation.less' }
			]}],

			[{
			line: 'pxx',
			tokens: [
				{ startIndex: 0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
			]}],

			// single line Strings
			[{
			line: '@test: "I\'m a LESS String";',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:25, type: 'string.punctuation.less' },
				{ startIndex:26, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: "concatenated" + "String";',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:20, type: 'string.punctuation.less' },
				{ startIndex:21, type: '' },
				{ startIndex:22, type: 'operator.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'string.punctuation.less' },
				{ startIndex:25, type: 'string.less' },
				{ startIndex:31, type: 'string.punctuation.less' },
				{ startIndex:32, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: "quote in\'adasdsa\\"asd\' a string"',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:39, type: 'string.punctuation.less' }
			]}],

			[{
			line: '@test: \'doublequote in"ada\\\'sds\\\'a"asd a string\'',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:47, type: 'string.punctuation.less' }
			]}],

			// Comments - range comment, multiple lines
			[{
			line: '/* start of multiline comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'a comment between without a star',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'end of multiline comment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: 'when /* start a comment',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'comment.less' }
			]}, {
			line: ' a ',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'and end it */ 2;',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:13, type: '' },
				{ startIndex:14, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:15, type: 'punctuation.less' }
			]}],

			// Numbers
			[{
			line: '0',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: ' 0',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: ' 0 ',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:2, type: '' }
			]}],

			[{
			line: '0 ',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:1, type: '' }
			]}],

			[{
			line: '@test: 0+0',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:8, type: 'operator.less' },
				{ startIndex:9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: '@test: 100+10.00',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:10, type: 'operator.less' },
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: '@test: 0 + 0',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:8, type: '' },
				{ startIndex:9, type: 'operator.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: '0123',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
			]}],

			[{
			line: '#012343',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' }
			]}],

			[{
			line: '[1,2,3]',
			tokens: [
				{ startIndex:0, type: 'punctuation.bracket.less' },
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:2, type: 'punctuation.less' },
				{ startIndex:3, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:4, type: 'punctuation.less' },
				{ startIndex:5, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:6, type: 'punctuation.bracket.less' }
			]}],

			[{
			line: 'foo(123);',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:3, type: 'punctuation.parenthesis.less' },
				{ startIndex:4, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: \'[{()}]\'',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:14, type: 'string.punctuation.less' }
			]}],

			// Singleline Comments
			[{
			line: '//',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '    // a comment',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:4, type: 'comment.less' }
			]}],

			[{
			line: '// a comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '//sticky comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@something : 2; // my comment // this is a nice one',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: 'comment.less' }
			]}],

			[{
			line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'variable.less' },
				{ startIndex:16, type: 'punctuation.less' },
				{ startIndex:17, type: '' },
				{ startIndex:18, type: 'variable.less' },
				{ startIndex:24, type: 'punctuation.parenthesis.less' },
				{ startIndex:25, type: '' },
				{ startIndex:26, type: 'keyword.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: 'punctuation.parenthesis.less' },
				{ startIndex:32, type: 'keyword.less' },
				{ startIndex:39, type: 'punctuation.parenthesis.less' },
				{ startIndex:40, type: 'variable.less' },
				{ startIndex:46, type: 'punctuation.parenthesis.less' },
				{ startIndex:48, type: '' },
				{ startIndex:49, type: 'punctuation.curly.less' },
				{ startIndex:50, type: '' },
				{ startIndex:51, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:56, type: 'comment.less' }
			]}],

			[{
			line: '.something(@some//mycomment',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'variable.less' },
				{ startIndex:16, type: 'comment.less' }
			]}],

			[{
			line: '@something : #2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
				{ startIndex:15, type: 'punctuation.less' }
			]}],

			// Singleline Range-Comments
			[{
			line: '/*slcomment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/* slcomment */',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/*sl/com* ment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/**/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@something: /*comm/* * /ent*/2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'comment.less' },
				{ startIndex:29, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:30, type: 'punctuation.less' }
			]}],

			[{
			line: '@something: /*comment*/ 2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'comment.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:25, type: 'punctuation.less' }
			]}],

			// Comments - range comment, multi lines
			[{
			line: '/* a multiline comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'can actually span',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'multiple lines */',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@some /* start a comment here',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'comment.less' }
			]}, {
			line: ' span over this line and ',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'end it there */ : 2;',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: 'punctuation.less' },
				{ startIndex:17, type: '' },
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:19, type: 'punctuation.less' }
			]}],

			// Escape Strings
			[{
			line: '.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' },
				{ startIndex:8, type: '' },
				{ startIndex:9, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:15, type: 'punctuation.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:19, type: 'string.less' },
				{ startIndex:55, type: 'string.punctuation.less' },
				{ startIndex:56, type: 'punctuation.less' }
			]}],

			// Guards
			[{
			line: '.class {.mixin (@a) when (@a > 10), (@a < -10) { }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' },
				{ startIndex:8, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: 'punctuation.parenthesis.less' },
				{ startIndex:16, type: 'variable.less' },
				{ startIndex:18, type: 'punctuation.parenthesis.less' },
				{ startIndex:19, type: '' },
				{ startIndex:20, type: 'keyword.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'punctuation.parenthesis.less' },
				{ startIndex:26, type: 'variable.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'operator.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:33, type: 'punctuation.parenthesis.less' },
				{ startIndex:34, type: 'punctuation.less' },
				{ startIndex:35, type: '' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:37, type: 'variable.less' },
				{ startIndex:39, type: '' },
				{ startIndex:40, type: 'operator.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'operator.less' },
				{ startIndex:43, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:45, type: 'punctuation.parenthesis.less' },
				{ startIndex:46, type: '' },
				{ startIndex:47, type: 'punctuation.curly.less' },
				{ startIndex:48, type: '' },
				{ startIndex:49, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.truth (@a) when (@a = true) { }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'keyword.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'punctuation.parenthesis.less' },
				{ startIndex:18, type: 'variable.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: 'operator.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'keyword.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'punctuation.curly.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.max (@a, @b) when (@a > @b) { width: @a; }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'punctuation.parenthesis.less' },
				{ startIndex:6, type: 'variable.less' },
				{ startIndex:8, type: 'punctuation.less' },
				{ startIndex:9, type: '' },
				{ startIndex:10, type: 'variable.less' },
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: '' },
				{ startIndex:14, type: 'keyword.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: 'punctuation.parenthesis.less' },
				{ startIndex:20, type: 'variable.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'operator.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'variable.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'punctuation.curly.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:36, type: 'punctuation.less' },
				{ startIndex:37, type: '' },
				{ startIndex:38, type: 'variable.less' },
				{ startIndex:40, type: 'punctuation.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.mixin (@a, @b: 0) when (isnumber(@b)) { }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'variable.less' },
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:17, type: 'punctuation.parenthesis.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: 'keyword.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'punctuation.parenthesis.less' },
				{ startIndex:25, type: 'keyword.less' },
				{ startIndex:33, type: 'punctuation.parenthesis.less' },
				{ startIndex:34, type: 'variable.less' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:38, type: '' },
				{ startIndex:39, type: 'punctuation.curly.less' },
				{ startIndex:40, type: '' },
				{ startIndex:41, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.mixin (@a, @b: black) when (iscolor(@b)) { }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'variable.less' },
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:21, type: 'punctuation.parenthesis.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'keyword.less' },
				{ startIndex:27, type: '' },
				{ startIndex:28, type: 'punctuation.parenthesis.less' },
				{ startIndex:29, type: 'keyword.less' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:37, type: 'variable.less' },
				{ startIndex:39, type: 'punctuation.parenthesis.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'punctuation.curly.less' },
				{ startIndex:43, type: '' },
				{ startIndex:44, type: 'punctuation.curly.less' }
			]}],

			// Nested JavaScript
			[{
			line: '@test: `function display()` //works well',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.backtick.less' },
				{ startIndex:8, type: 'mock-js' },
				{ startIndex:26, type: 'punctuation.backtick.less' },
				{ startIndex:27, type: '' },
				{ startIndex:28, type: 'comment.less' }
			]}],

			// Attribute in a .class(...)
			[{
			line: '.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:11, type: 'punctuation.parenthesis.less' },
				{ startIndex:12, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:17, type: '' },
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:19, type: '' },
				{ startIndex:20, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:25, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:27, type: '' },
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:32, type: 'punctuation.parenthesis.less' },
				{ startIndex:33, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:34, type: 'punctuation.less' },
				{ startIndex:35, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:36, type: 'punctuation.less' },
				{ startIndex:37, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:38, type: 'punctuation.less' },
				{ startIndex:39, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:43, type: 'punctuation.parenthesis.less' },
				{ startIndex:44, type: 'punctuation.less' },
				{ startIndex:45, type: '' },
				{ startIndex:46, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:47, type: '' },
				{ startIndex:48, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:49, type: '' },
				{ startIndex:50, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:51, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:53, type: '' },
				{ startIndex:54, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:58, type: 'punctuation.parenthesis.less' },
				{ startIndex:59, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:61, type: 'punctuation.less' },
				{ startIndex:62, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:65, type: 'punctuation.less' },
				{ startIndex:66, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:69, type: 'punctuation.less' },
				{ startIndex:70, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:72, type: 'punctuation.parenthesis.less' },
				{ startIndex:74, type: 'punctuation.less' }
			]}],

			// Difficult little bugs... => String mismatches
			[{
			line: 'input[type="radio"]',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'punctuation.bracket.less' },
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:10, type: 'operator.less' },
				{ startIndex:11, type: 'string.punctuation.less' },
				{ startIndex:12, type: 'string.less' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:18, type: 'punctuation.bracket.less' }
			]}],

			[{
			line: '~\'.offset@{index}\')',
			tokens: [
				{ startIndex:0, type: 'string.punctuation.less' },
				{ startIndex:2, type: 'string.less' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:18, type: 'punctuation.parenthesis.less' }
			]}],

			[{
			line: 'some("\\42");',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:4, type: 'punctuation.parenthesis.less' },
				{ startIndex:5, type: 'string.punctuation.less' },
				{ startIndex:6, type: 'string.less' },
				{ startIndex:9, type: 'string.punctuation.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'punctuation.less' }
			]}],

			[{
			line: ' ~ "icon-"',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:1, type: 'operator.less' },
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'string.punctuation.less' },
				{ startIndex:4, type: 'string.less' },
				{ startIndex:9, type: 'string.punctuation.less' }
			]}],

			// Difficult little bugs... => Operator mismatches
			[{
			line: 'class^="icon-"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class*="icon-"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class~="icon-"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class ~ = "icon-"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'operator.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'operator.less' },
				{ startIndex:9, type: '' },
				{ startIndex:10, type: 'string.punctuation.less' },
				{ startIndex:11, type: 'string.less' },
				{ startIndex:16, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class|="icon-"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: '.hide-text { font: 0/0 a; }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.curly.less' },
				{ startIndex:12, type: '' },
				{ startIndex:13, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:17, type: 'punctuation.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:20, type: 'operator.less' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:24, type: 'punctuation.less' },
				{ startIndex:25, type: '' },
				{ startIndex:26, type: 'punctuation.curly.less' }
			]}],

			// Difficult little bugs... => Numbers in classes
			[{
			line: '.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: 'variable.less' },
				{ startIndex:15, type: 'punctuation.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'variable.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: 'variable.less' },
				{ startIndex:23, type: 'punctuation.parenthesis.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'punctuation.curly.less' },
				{ startIndex:26, type: '' },
				{ startIndex:27, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:44, type: 'punctuation.less' },
				{ startIndex:45, type: '' },
				{ startIndex:46, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:57, type: 'punctuation.parenthesis.less' },
				{ startIndex:58, type: 'variable.less' },
				{ startIndex:60, type: 'punctuation.less' },
				{ startIndex:61, type: '' },
				{ startIndex:62, type: 'variable.less' },
				{ startIndex:64, type: 'punctuation.less' },
				{ startIndex:65, type: '' },
				{ startIndex:66, type: 'variable.less' },
				{ startIndex:68, type: 'punctuation.parenthesis.less' },
				{ startIndex:69, type: 'punctuation.less' },
				{ startIndex:70, type: '' },
				{ startIndex:71, type: 'punctuation.curly.less' }
			]}],

			// Difficult little bugs... => Generic mismatches, worst case...
			[{
			line: '.dropdown-menu > li > a:hover > [class=" icon-"]',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: 'operator.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:19, type: '' },
				{ startIndex:20, type: 'operator.less' },
				{ startIndex:21, type: '' },
				{ startIndex:22, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'operator.less' },
				{ startIndex:31, type: '' },
				{ startIndex:32, type: 'punctuation.bracket.less' },
				{ startIndex:33, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:38, type: 'operator.less' },
				{ startIndex:39, type: 'string.punctuation.less' },
				{ startIndex:40, type: 'string.less' },
				{ startIndex:46, type: 'string.punctuation.less' },
				{ startIndex:47, type: 'punctuation.bracket.less' }
			]}],

			[{
			line: '.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) { background: -webkit-gradient(color-stop(0, rgb(@start,@start,@start)), color-stop(1, rgb(@stop,@stop,@stop))); }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: 'variable.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'variable.less' },
				{ startIndex:36, type: 'punctuation.less' },
				{ startIndex:37, type: '' },
				{ startIndex:38, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:39, type: 'punctuation.less' },
				{ startIndex:40, type: '' },
				{ startIndex:41, type: 'variable.less' },
				{ startIndex:46, type: 'punctuation.less' },
				{ startIndex:47, type: '' },
				{ startIndex:48, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:51, type: 'punctuation.parenthesis.less' },
				{ startIndex:52, type: '' },
				{ startIndex:53, type: 'punctuation.curly.less' },
				{ startIndex:54, type: '' },
				{ startIndex:55, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:65, type: 'punctuation.less' },
				{ startIndex:66, type: '' },
				{ startIndex:67, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:83, type: 'punctuation.parenthesis.less' },
				{ startIndex:84, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:94, type: 'punctuation.parenthesis.less' },
				{ startIndex:95, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:96, type: 'punctuation.less' },
				{ startIndex:97, type: '' },
				{ startIndex:98, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:101, type: 'punctuation.parenthesis.less' },
				{ startIndex:102, type: 'variable.less' },
				{ startIndex:108, type: 'punctuation.less' },
				{ startIndex:109, type: 'variable.less' },
				{ startIndex:115, type: 'punctuation.less' },
				{ startIndex:116, type: 'variable.less' },
				{ startIndex:122, type: 'punctuation.parenthesis.less' },
				{ startIndex:124, type: 'punctuation.less' },
				{ startIndex:125, type: '' },
				{ startIndex:126, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:136, type: 'punctuation.parenthesis.less' },
				{ startIndex:137, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:138, type: 'punctuation.less' },
				{ startIndex:139, type: '' },
				{ startIndex:140, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:143, type: 'punctuation.parenthesis.less' },
				{ startIndex:144, type: 'variable.less' },
				{ startIndex:149, type: 'punctuation.less' },
				{ startIndex:150, type: 'variable.less' },
				{ startIndex:155, type: 'punctuation.less' },
				{ startIndex:156, type: 'variable.less' },
				{ startIndex:161, type: 'punctuation.parenthesis.less' },
				{ startIndex:164, type: 'punctuation.less' },
				{ startIndex:165, type: '' },
				{ startIndex:166, type: 'punctuation.curly.less' }
			]}],

			// Skip whitespace
			[{
			line: '      body ',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:10, type: '' }
			]}],

			// CSS rule
			//	body {
			//	  margin: 0;
			//	  padding: 3em 6em;
			//	  font-family: tahoma, arial, sans-serif;
			//	  text-decoration: none !important;
			//	  color: #000
			//	}
			[{
			line: 'body {',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'punctuation.curly.less' }
			]}, {
			line: '  margin: 0;',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:8, type: 'punctuation.less' },
				{ startIndex:9, type: '' },
				{ startIndex:10, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:11, type: 'punctuation.less' }
			]}, {
			line: '  padding: 3em 6em;',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:12, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:18, type: 'punctuation.less' }
			]}, {
			line: '  font-family: tahoma, arial, sans-serif;',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:13, type: 'punctuation.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:21, type: 'punctuation.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:40, type: 'punctuation.less' }
			]}, {
			line: '  text-decoration: none !important;',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:17, type: 'punctuation.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'keyword.less' },
				{ startIndex:34, type: 'punctuation.less' }
			]}, {
			line: '  color: #000;',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:7, type: 'punctuation.less' },
				{ startIndex:8, type: '' },
				{ startIndex:9, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
				{ startIndex:13, type: 'punctuation.less' }
			]}, {
			line: '  }',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' }
			]}],

			// CSS units and numbers
			[{
			line: '* { padding: 3em -9pt -0.5px; }',
			tokens: [
				{ startIndex:0, type: 'operator.less' },
				{ startIndex:1, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' },
				{ startIndex:3, type: '' },
				{ startIndex:4, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:14, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'operator.less' },
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:21, type: '' },
				{ startIndex:22, type: 'operator.less' },
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:26, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'punctuation.curly.less' }
			]}],

			// CSS single line comment
			//	h1 /*comment*/ p  {
			[{
			line: 'h1 /*comment*/ p {',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'comment.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'punctuation.curly.less' }
			]}],

			// CSS multi line comment
			//	h1 /*com
			//  ment*/ p  {
			[{
			line: 'h1 /*com',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'comment.less' }
			]}, {
			line: 'ment*/ p',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
			]}],

			// CSS ID rule
			//	#myID {
			//	  font-size: 80%;
			//	  content: 'contents';
			//	}
			[{
			line: '#myID {',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.id.less' },
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'punctuation.curly.less' }
			]}],

			// CSS Class rules
			//	.myID {
			//	h1 > p {
			[{
			line: '.myID {',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'punctuation.curly.less' }
			]}],

			// CSS @import etc
			//	@import url('something.less'); {
			[{
			line: '@import url("something.less");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'function.less' },
				{ startIndex:12, type: 'string.punctuation.less' },
				{ startIndex:13, type: 'string.less' },
				{ startIndex:27, type: 'string.punctuation.less' },
				{ startIndex:28, type: 'punctuation.parenthesis.less' },
				{ startIndex:29, type: 'punctuation.less' }
			]}],

			// CSS multi-line string with an escaped newline
			//	body {
			//	content: 'con\
			//  tent';
			[{
			line: 'body {',
			tokens: null}, {
			line: '  content: "con\\',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'string.punctuation.less' },
				{ startIndex:12, type: 'string.less' }
			]}, {
			line: 'tent";',
			tokens: [
				{ startIndex:0, type: 'string.less' },
				{ startIndex:4, type: 'string.punctuation.less' },
				{ startIndex:5, type: 'punctuation.less' }
			]}],

			// CSS empty string value
			//	body {
			//	content: '';
			[{
			line: 'body {',
			tokens: null}, {
			line: '  content: "";',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'string.punctuation.less' },
				{ startIndex:13, type: 'punctuation.less' }
			]}],

			// LESS IE star hacks
			[{
			line: 'body {',
			tokens: null}, {
			line: '  _content: "";',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'string.punctuation.less' },
				{ startIndex:14, type: 'punctuation.less' }
			]}],

			// CSS font face
			// @font-face {
			//     font-family: 'Opificio';
			// }
			[{
			line: '@font-face {',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.curly.less' }
			]}, {
			line: '  font-family: "Opificio";',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:13, type: 'punctuation.less' },
				{ startIndex:14, type: '' },
				{ startIndex:15, type: 'string.punctuation.less' },
				{ startIndex:16, type: 'string.less' },
				{ startIndex:24, type: 'string.punctuation.less' },
				{ startIndex:25, type: 'punctuation.less' }
			]}],

			// CSS string with escaped quotes
			//	's\"tr'
			[{
			line: '"s\\"tr\\"sadsad',
			tokens: [
				{ startIndex:0, type: 'string.punctuation.less' },
				{ startIndex:1, type: 'string.less' }
			]}],

			[{
			line: 'p{}',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:1, type: 'punctuation.curly.less' }
			]}],

			[{
			line: 'p:nth() {}',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'punctuation.parenthesis.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'punctuation.curly.less' }
			]}],

			// EG: import statement - bug #10308
			//	@import url('something.css');@import url('something.css');
			[{
			line: '@import url("something.css");@import url("something.css");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'function.less' },
				{ startIndex:12, type: 'string.punctuation.less' },
				{ startIndex:13, type: 'string.less' },
				{ startIndex:26, type: 'string.punctuation.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: 'keyword.less' },
				{ startIndex:36, type: '' },
				{ startIndex:37, type: 'function.less' },
				{ startIndex:41, type: 'string.punctuation.less' },
				{ startIndex:42, type: 'string.less' },
				{ startIndex:55, type: 'string.punctuation.less' },
				{ startIndex:56, type: 'punctuation.parenthesis.less' },
				{ startIndex:57, type: 'punctuation.less' }
			]}],

			// EG: Triple quotes - bug #9870
			[{
			line: '""""',
			tokens: [
				{ startIndex:0, type: 'string.punctuation.less' }
			]}],

			// EG: CSS @import related coloring bug 9553
			[{
			line: '@import url("something.css");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'function.less' },
				{ startIndex:12, type: 'string.punctuation.less' },
				{ startIndex:13, type: 'string.less' },
				{ startIndex:26, type: 'string.punctuation.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: 'punctuation.less' }
			]}, {
			line: '.rule1{}',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: 'punctuation.curly.less' }
			]}, {
			line: '.rule2{}',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:6, type: 'punctuation.curly.less' }
			]}],

			// EG: CSS key frame animation syntax
			[{
			line: '@-webkit-keyframes infinite-spinning {',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:36, type: '' },
				{ startIndex:37, type: 'punctuation.curly.less' }
			]}, {
			line: '  from {',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' }
			]}, {
			line: '  -webkit-transform: rotate(0deg);',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:29, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:32, type: 'punctuation.parenthesis.less' },
				{ startIndex:33, type: 'punctuation.less' }
			]}, {
			line: '	 }',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' }
			]}, {
			line: '  to {',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'punctuation.curly.less' }
			]}, {
			line: '  -webkit-transform: rotate(360deg);',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:31, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
				{ startIndex:34, type: 'punctuation.parenthesis.less' },
				{ startIndex:35, type: 'punctuation.less' }
			]}, {
			line: '	 }',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' }
			]}, {
			line: '}',
			tokens: [
				{ startIndex:0, type: 'punctuation.curly.less' }
			]}]
		]);
	});

	test('identifier escaping', function() {
		modesUtil.assertTokenization(tokenizationSupport, [{
			line: 'input[type= \\"submit\\"',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:5, type: 'punctuation.bracket.less'},
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
				{ startIndex:10, type: 'operator.less'},
				{ startIndex:11, type: ''},
				{ startIndex:12, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'}
			]}
		]);
	});

	test('identifier escaping 2', function() {
		modesUtil.assertTokenization(tokenizationSupport, [{
			line: '.\\34 hello { -moz-foo: --myvar }',
			tokens: [
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
				{ startIndex:10, type: ''},
				{ startIndex:11, type: 'punctuation.curly.less'},
				{ startIndex:12, type: ''},
				{ startIndex:13, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'},
				{ startIndex:22, type: ''},
				{ startIndex:23, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'},
				{ startIndex:30, type: ''},
				{ startIndex:31, type: 'punctuation.curly.less'},
			]}
		]);
	});

	test('onEnter', function() {
		assertOnEnter.indents('', '.myRule {', '');
		assertOnEnter.indents('', 'background: url(', '');
		assertOnEnter.indents('', '.myRule[', '');
		assertOnEnter.indentsOutdents('', '.myRule {', '}');
	});
});


text:
layout: page
title: A practical, lightweight, hybrid cache sharing/partitioning scheme for multicore systems
permalink: /seminars/CashePartitioning/
date: February 08, 2017
---

## A practical, lightweight, hybrid cache sharing/partitioning scheme for multicore systems

### Speaker:

[Nosayba El-Sayed]()

### Abstract:

In shared datacenters, multicore servers often run multiple applications to improve system utilization. However, colocated applications interfere in shared resources, such as the last-level cache (LLC), causing performance inefficiencies. Recently, support for partitioning the LLC has been added to commercial hardware, providing a promising, lightweight venue for tackling these inefficiencies. The key challenge in using hardware-based LLC partitioning, however, is that it provides coarse-grained partition sizes for applications, which may cause performance degradations.

In this talk, I will discuss these limitations and present a technique we are investigating to facilitate the practical adoption of LLC partitioning in multicore systems. Our technique is based on a hybrid approach that combines cache sharing and cache partitioning features. We utilize a hierarchical clustering algorithm to make data-driven decisions about which applications can share cache partitions and which should be isolated. For more details, I'll see you this Wednesday!


text:
import SecurityErrorEvent from "openfl/events/SecurityErrorEvent";
import * as assert from "assert";

describe ("TypeScript | SecurityErrorEvent", function () {

	it ("new", function () {

		// TODO: Confirm functionality

		var securityErrorEvent = new SecurityErrorEvent (SecurityErrorEvent.SECURITY_ERROR);
		assert.notEqual (securityErrorEvent, null);

	});

});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
FloatBead
</TITLE>

<META NAME="date" CONTENT="2010-04-18">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

net.beadsproject.beads.events

Interface FloatBead

public interface FloatBead

Interface used to indicate a Bead that stores a single float value.

Method Summary

 float
getFloat()

          Gets the float value.

Method Detail

getFloat

float getFloat()

Gets the float value.

Returns:
the float value.

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
module Grape
  # The current version of Grape.
  VERSION = '1.0.0.beta'.freeze
end


text:
package org.tools4j.spockito;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.tools4j.spockito.Spockito.Name;
import org.tools4j.spockito.Spockito.Unroll;

@Unroll({
        "| Operation | Sign | Operand1 | Operand2 | Result | NeutralOperand |",
        "|-----------|------|----------|----------|--------|----------------|",
        "| Add       |   +  |        4 |        7 |     11 |              0 |",
        "| Subtract  |   -  |      111 |       12 |     99 |              0 |",
        "| Multiply  |   *  |       24 |        5 |    120 |              1 |",
        "| Divide    |   /  |       24 |        3 |      8 |              1 |"
})
@Name("[{row}]: {Operation}")
@RunWith(Spockito.class)
public class UnrollClassDataToFieldsTest {

    @Spockito.Ref
    private Operation operation;
    @Spockito.Ref
    private char sign;
    @Spockito.Ref
    private int operand1;
    @Spockito.Ref
    private int operand2;
    @Spockito.Ref
    private int result;
    @Spockito.Ref
    private int neutralOperand;

    @Test
    @Spockito.Name("[{row}]: {Operand1} {Sign} {Operand2} = {Result}")
    public void testOperation() {
        Assert.assertEquals("Result is wrong!", result, operation.evaluate(operand1, operand2));
    }

    @Test
    @Spockito.Name("[{row}]: {Operand1} {Sign} {NeutralOperand} = {Operand1}")
    public void testNeutralOperand() {
        Assert.assertEquals("Result with neutral operand is wrong!",
                operand1, operation.evaluate(operand1, neutralOperand));
    }
}


text:
var TwitterCldr = require('../../../lib/assets/javascripts/twitter_cldr/en.js');
eval(require('fs').readFileSync('lib/assets/javascripts/twitter_cldr/test_resources.js', 'utf8'));
formatter = new TwitterCldr.RBNF();

formatter.resource = TwitterCldr.RBNF.global_resource;
describe("RBNF", function() {
  for (locale in TwitterCldr.RBNF.test_resource) {
    if (["ar", "ja", "ko", "zh", "ja", "zh-Hant", "ja", "hi", "ta"].indexOf(locale) !== -1)
      continue;

    TwitterCldr.PluralRules.rules = TwitterCldr.PluralRules.global_rules[locale];
    TwitterCldr.PluralRules.names = TwitterCldr.PluralRules.global_names[locale];
    TwitterCldr.NumberFormatter.all_tokens = TwitterCldr.NumberFormatter.global_tokens[locale];
    TwitterCldr.NumberFormatter.symbols = TwitterCldr.NumberFormatter.global_symbols[locale];

    formatter.locale = locale;

    describe("for locale: " + locale, function() {
      for (rule_group in TwitterCldr.RBNF.test_resource[locale]) {
        if (formatter.group_names().indexOf(rule_group) === -1)
          continue;

        describe("for Group: " + rule_group, function() {
          for (rule_set in TwitterCldr.RBNF.test_resource[locale][rule_group]) {
            if (formatter.rule_set_names_for_group(rule_group).indexOf(rule_set) === -1)
              continue;

            describe("for Set: " + rule_set, function() {
              it("formats " + "test_case" + " correctly", function() {
                for (test_case in TwitterCldr.RBNF.test_resource[locale][rule_group][rule_set]) {
                  try {
                    var got = formatter.format(TwitterCldr.PluralRules.runtime.toNum(test_case), rule_group, rule_set);
                    var expected = TwitterCldr.RBNF.test_resource[locale][rule_group][rule_set][test_case];

                    expect(got).toEqual(expected);
                  }
                  catch (error) {
                    // Ignore `Not implemented` errors.
                  }
                }
              }());
            });
          }
        });
      }
    });
  }
});

// Reset the variables to undo the changes in the global scope.
TwitterCldr.PluralRules.rules = TwitterCldr.PluralRules.global_rules["en"];
TwitterCldr.PluralRules.names = TwitterCldr.PluralRules.global_names["en"];
TwitterCldr.NumberFormatter.all_tokens = TwitterCldr.NumberFormatter.global_tokens["en"];
TwitterCldr.NumberFormatter.symbols = TwitterCldr.NumberFormatter.global_symbols["en"];


text:
Instructions to get running

Prerequisits:
- Install Haskell (ghc) and cabal package manager/build system
- Clone repository
- cd into local checkout

Commands to Set Up Environment (in {CHECKOUT}/server/ directory):

    cabal sandbox init # This makes installed packages local to this project
    cabal sandbox add-source ../stardata
    cabal install      # Installs all dependant packages and runtime data
    cabal configure    # Sets up whats needed for cabal to compile/run

Commands to Compile and Run:

    cabal build        # Compile everything
    cabal run          # Run the program


text:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<link rel="stylesheet" type="text/css" href="../../../scineplex.css">
<title></title>
<link rel="stylesheet" href="../../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />

NAME

SYNOPSIS

INHERITANCE

DESCRIPTION

METHODS

ancestor_of

can_be_quantified

class

comment

content

descendant_of

is_quantifier

next_sibling

parent

perl_version_introduced

perl_version_removed

previous_sibling

significant

snext_sibling

sprevious_sibling

tokens

top

whitespace

nav

SUPPORT

AUTHOR

COPYRIGHT AND LICENSE

NAME

PPIx::Regexp::Element - Base of the PPIx::Regexp hierarchy.

SYNOPSIS

No user-serviceable parts inside.

INHERITANCE

PPIx::Regexp::Element is not descended from any other class.

PPIx::Regexp::Element is the parent of PPIx::Regexp::Node and PPIx::Regexp::Token.

DESCRIPTION

This class is the base of the PPIx::Regexp object hierarchy. It provides the same kind of navigational functionality that is provided by PPI::Element.

METHODS

This class provides the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice.

ancestor_of

This method returns true if the object is an ancestor of the argument, and false otherwise. By the definition of this method, $self is its own ancestor.

can_be_quantified

 $token->can_be_quantified()
     and print "This element can be quantified.\n";

This method returns true if the element can be quantified.

class

This method returns the class name of the element. It is the same as ref $self.

comment

This method returns true if the element is a comment and false otherwise.

content

This method returns the content of the element.

descendant_of

This method returns true if the object is a descendant of the argument, and false otherwise. By the definition of this method, $self is its own descendant.

is_quantifier

 $token->is_quantifier()
     and print "This element is a quantifier.\n";

This method returns true if the element is a quantifier. You can not tell this from the element's class, because a right curly bracket may represent a quantifier for the purposes of figuring out whether a greediness token is possible.

next_sibling

This method returns the element's next sibling, or nothing if there is none.

parent

This method returns the parent of the element, or undef if there is none.

perl_version_introduced

This method returns the version of Perl in which the element was introduced. This will be at least 5.000. Before 5.006 I am relying on the perldelta, perlre, and perlop documentation, since I have been unable to build earlier Perls. Since I have found no documentation before 5.003, I assume that anything found in 5.003 is also in 5.000.

Since this all depends on my ability to read and understand masses of documentation, the results of this method should be viewed with caution, if not downright skepticism.

There are also cases which are ambiguous in various ways. For those see "RESTRICTIONS" in PPIx::Regexp, and especially "Changes in Syntax" in PPIx::Regexp.

perl_version_removed

This method returns the version of Perl in which the element was removed. If the element is still valid the return is undef.

All the caveats to perl_version_introduced() apply here also, though perhaps less severely since although many features have been introduced since 5.0, few have been removed.

previous_sibling

This method returns the element's previous sibling, or nothing if there is none.

significant

This method returns true if the element is significant and false otherwise.

snext_sibling

This method returns the element's next significant sibling, or nothing if there is none.

sprevious_sibling

This method returns the element's previous significant sibling, or nothing if there is none.

tokens

This method returns all tokens contained in the element.

top

This method returns the top of the hierarchy.

whitespace

This method returns true if the element is whitespace and false otherwise.

nav

This method returns navigation information from the top of the hierarchy to this node. The return is a list of names of methods and references to their argument lists. The idea is that given $elem which is somewhere under $top,

 my @nav = $elem->nav();
 my $obj = $top;
 while ( @nav ) {
     my $method = shift @nav;
     my $args = shift @nav;
     $obj = $obj->$method( @{ $args } ) or die;
 }
 # At this point, $obj should contain the same object
 # as $elem.

SUPPORT

Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2009-2012 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.


text:
using System;

namespace MineLib.Core.Exceptions
{
    public class NetworkHandlerException : Exception
    {
        public NetworkHandlerException() : base() { }

        public NetworkHandlerException(string message) : base(message) { }

        public NetworkHandlerException(string format, params object[] args) : base(string.Format(format, args)) { }

        public NetworkHandlerException(string message, Exception innerException) : base(message, innerException) { }

        public NetworkHandlerException(string format, Exception innerException, params object[] args) : base(string.Format(format, args), innerException) { }
    }
}


text:
var fs = require('fs');
var url = require('url');
var path = require('path');
var webpack = require('webpack');

var DEBUG = !process.argv.production;

var GLOBALS = {
	'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
	'__DEV__': DEBUG
};

module.exports = {
	// Main entry directory and file
	entry: {
		app: [
			// 'webpack/hot/dev-server',
			path.join(__dirname, 'app', 'main.js')
		]
	},

	// Output directories and file
	output: {
		path: path.join(__dirname, 'dist'),
		filename: '[name].js',
		chunkFilename: '[name].chunk.js',
		publicPath: '/durandal-webpack/dist/'
	},

	// Custom plugins
	plugins: [
		new webpack.DefinePlugin(GLOBALS),
		new webpack.optimize.OccurenceOrderPlugin()
	]
	.concat(DEBUG ? [] : [
		new webpack.optimize.DedupePlugin(),
		new webpack.optimize.UglifyJsPlugin(),
		new webpack.optimize.AggressiveMergingPlugin()
	]),

	module: {
		loaders: [
			{ test: /\.html$/, loader: 'html' },
			{ test: /\.json$/, loader: 'json' }
		]
	},

	resolve: {
		extensions: ['', '.js', '.jsx', '.json'],

		modulesDirectories: [
			'node_modules',
			'app'
		],

		root: path.join(__dirname, 'app'),

		alias: {
			durandal: 'durandal/js',
			plugins: 'durandal/js/plugins'
		}
	},

	externals: {
		jquery: 'jQuery'
	},

	devServer: {
		contentBase: __dirname,
		hot: false,
		inline: true,
		historyApiFallback: true,
		stats: { colors: true },
		progress: true
	}
};