lhs, xpo ...

View: New views
6 Messages — Rating Filter:   Alert me  

lhs, xpo ...

by Max Belugin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Я периодически сталкиваюсь с необходимостью расцвечивать вcтроекнные
фграгменты языков, которые представлены следующим образом:

1. Есть текст на основном языке
2. Внустри встроен фрагмент
3. Этот фрагмент выделяется спецсимволами __в начале__ каждой строки фрагмента.


Как это удобно объяснить колореру?

=== Пример 1: xpo файл Dynamics Ax

После тега SOURCE идет текст функции, каждая строчка начинается с #

Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: CLS

; Microsoft Business Solutions-Axapta Class: TrucosAx_TrapperBase
descargados en Jueves 26/04/2007
; --------------------------------------------------------------------------------
  CLSVERSION 1

  CLASS #TrucosAx_TrapperBase
    PROPERTIES
      Name                #TrucosAx_TrapperBase
      Extends             #Object
      RunOn               #Client
    ENDPROPERTIES

    METHODS
      Version: 3
      SOURCE #BufferAddr
        #protected final int BufferAddr ( Binary _buffer, int _byte =
-1, int _offset = 0 )
        #{
        #     binary t;
        #     int addr;
        #     ;
        #      // Pasandolo a otro binary conseguimos su direcciєn de memoria
        #      t = new binary(4);
        #      t.binary(0,_buffer);
        #
        #      // Si no queremos el punto 0 sino alguna posiciєn mсs
avanzada dentro del buffer
        #      if (_offset)
        #       t.dWord(0, t.dWord(0) + _offset);
        #
        #      // -1 devuelve toda la direcciєn, 0..3 devuelve cada
uno de los 4 bytes
        #      switch(_byte)
        #      {
        #        case -1 : addr = t.dWord(0); break;
        #
        #        default : addr = t.byte(_byte); break;
        #      }
        #      return addr;
        #}
      ENDSOURCE
....

=== Пример 2: lhs - literal haskell

Исполнимые код выделен > в начале строки

Test/HUnit/Lang.lhs  --  HUnit language support.

> module Test.HUnit.Lang
> (
>   Assertion,
>   assertFailure,
>   performTestCase
> )
> where


When adapting this module for other Haskell language systems, change
the imports and the implementations but not the interfaces.



Imports
-------

> import Data.List (isPrefixOf)

> import Control.Exception (try)


--
Max Belugin, http://belugin.info , ICQ:9406811
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks

Re: lhs, xpo ...

by Igor Russkih :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry for Russian, quite a specific question.

Совершенно неразбираемые конструкции с точки зрения теории и практики
формальных языков ;)

С колорером думаю можно добиться желаемого хаками.
Вход в схему - символ начала выделения start= /^ \M \s* \# /
Выход - отсутствие этого символа end= / ^ \s* ($ | [^#\s]) /
схема - переопределение схем целевого языка с добавлением правил типа
regexp match = /^ \s* \# /
чтобы сьедались эти символы в начале.

Проблемы возникнут если во встроенном языке будут
незакрытые/перекрытые рекурсивные конструкции типа

# foreach (a: b) {
go back to text mode
# }




On 5/14/07, Max Belugin <mbelugin@...> wrote:

> Я периодически сталкиваюсь с необходимостью расцвечивать вcтроекнные
> фграгменты языков, которые представлены следующим образом:
>
> 1. Есть текст на основном языке
> 2. Внустри встроен фрагмент
> 3. Этот фрагмент выделяется спецсимволами __в начале__ каждой строки фрагмента.
>
>
> Как это удобно объяснить колореру?
>
> === Пример 1: xpo файл Dynamics Ax
>
> После тега SOURCE идет текст функции, каждая строчка начинается с #
>
> Exportfile for AOT version 1.0 or later
> Formatversion: 1
>
> ***Element: CLS
>
> ; Microsoft Business Solutions-Axapta Class: TrucosAx_TrapperBase
> descargados en Jueves 26/04/2007
> ; --------------------------------------------------------------------------------
>   CLSVERSION 1
>
>   CLASS #TrucosAx_TrapperBase
>     PROPERTIES
>       Name                #TrucosAx_TrapperBase
>       Extends             #Object
>       RunOn               #Client
>     ENDPROPERTIES
>
>     METHODS
>       Version: 3
>       SOURCE #BufferAddr
>         #protected final int BufferAddr ( Binary _buffer, int _byte =
> -1, int _offset = 0 )
>         #{
>         #     binary t;
>         #     int addr;
>         #     ;
>         #      // Pasandolo a otro binary conseguimos su direcciєn de memoria
>         #      t = new binary(4);
>         #      t.binary(0,_buffer);
>         #
>         #      // Si no queremos el punto 0 sino alguna posiciєn mсs
> avanzada dentro del buffer
>         #      if (_offset)
>         #       t.dWord(0, t.dWord(0) + _offset);
>         #
>         #      // -1 devuelve toda la direcciєn, 0..3 devuelve cada
> uno de los 4 bytes
>         #      switch(_byte)
>         #      {
>         #        case -1 : addr = t.dWord(0); break;
>         #
>         #        default : addr = t.byte(_byte); break;
>         #      }
>         #      return addr;
>         #}
>       ENDSOURCE
> ....
>
> === Пример 2: lhs - literal haskell
>
> Исполнимые код выделен > в начале строки
>
> Test/HUnit/Lang.lhs  --  HUnit language support.
>
> > module Test.HUnit.Lang
> > (
> >   Assertion,
> >   assertFailure,
> >   performTestCase
> > )
> > where
>
>
> When adapting this module for other Haskell language systems, change
> the imports and the implementations but not the interfaces.
>
>
>
> Imports
> -------
>
> > import Data.List (isPrefixOf)
>
> > import Control.Exception (try)
>
>
> --
> Max Belugin, http://belugin.info , ICQ:9406811
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> colorer-talks mailing list
> colorer-talks@...
> https://lists.sourceforge.net/lists/listinfo/colorer-talks
>


--
  Igor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks

Re: lhs, xpo ...

by Max Belugin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

А с питоновскими отступами что-то можено сделать?

типа
def x(a):
    def y(b):
         return b
    return y(a)

print x(1)

On 5/14/07, Igor Russkih <irusskih@...> wrote:
> Совершенно неразбираемые конструкции с точки зрения теории и практики
> формальных языков ;)
--
Max Belugin, http://belugin.info , ICQ:9406811
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks

Re: lhs, xpo ...

by Igor Russkih :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Если очень постараться - можно вычленить парные структуры. Но не
уверен что в этом есть смысл.

Лучше описать нормальный outline для такого синтаксиса и пользоваться им...

On 5/14/07, Max Belugin <mbelugin@...> wrote:

> А с питоновскими отступами что-то можено сделать?
>
> типа
> def x(a):
>     def y(b):
>          return b
>     return y(a)
>
> print x(1)
>
> On 5/14/07, Igor Russkih <irusskih@...> wrote:
> > Совершенно неразбираемые конструкции с точки зрения теории и практики
> > формальных языков ;)
> --
> Max Belugin, http://belugin.info , ICQ:9406811
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> colorer-talks mailing list
> colorer-talks@...
> https://lists.sourceforge.net/lists/listinfo/colorer-talks
>


--
  Igor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks

Re: lhs, xpo ...

by Max Belugin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

описать нормальный outline

где это можно сделать в FarColorer?


On 5/14/07, Igor Russkih <irusskih@...> wrote:
> Лучше описать нормальный outline для такого синтаксиса и пользоваться им...
--
Max Belugin, http://belugin.info , ICQ:9406811
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks

Re[2]: lhs, xpo ...

by Andrey Repin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Здравствуйте, Уважаемый(-ая, -ое) Common buzz on colorer!

IR>> Лучше описать нормальный outline для такого синтаксиса и пользоваться им...

MB> где это можно сделать в FarColorer?

Распаковать common.jar и порыться в соответствующих местах proto.hrc
Формат прозрачный, я быстро добился взаимопонимания.


--
С уважением

    Andrey Repin (hell-for-yahoo@...) вторник, 15.05.2007, <19:47>
 * Winamp: Now playing a White dove (Scorpions/RC More gold (Vol 1))


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
colorer-talks mailing list
colorer-talks@...
https://lists.sourceforge.net/lists/listinfo/colorer-talks