Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Source Formatter

<< < (8/10) > >>

Ceniza:

--- Quote from: tiwag ---98/1/1
--- End quote ---

Yep, that'd be a huge problem.


--- Quote from: Michael ---Look really cool :D. But before a final judgement I would like to see it in action... :D
--- End quote ---

See it in action? I just came up with the idea! Those dialogs were made with wxSmith (I got wxSmith to crash many times creating the second one :P) with 0 functionality.


--- Quote from: Michael ---@Ceniza: I cannot SVN update the SourceFormatter, because it seems that your server refuses the connection. Should I try later?
--- End quote ---

I rebooted the machine where that's stored two times today (I needed its CD-ROM drive :P) and it seems svnserve wasn't started.

Ok, found the problem: I decided to add the command to start svnserve at the end of /etc/init.d/bootmisc.sh, but /etc/rcS.d/S55bootmisc.sh is a file and not a symlink so it was useless. Now I added it to the one in rcS.d :)

I just started it manually so it should work now.

Sorry for the Linux talking :P

Michael:

--- Quote from: Ceniza on January 19, 2006, 07:48:02 pm ---
--- Quote from: Michael ---Look really cool :D. But before a final judgement I would like to see it in action... :D
--- End quote ---

See it in action? I just came up with the idea! Those dialogs were made with wxSmith (I got wxSmith to crash many times creating the second one :P) with 0 functionality.

--- End quote ---

Ok. Anyway, your idea is very good :D. The Learn button gives an air of AI... :D

Concerning the wxSmith crashes (Windows, right?), you should may be post them.


--- Quote from: Ceniza on January 19, 2006, 07:48:02 pm ---
--- Quote from: Michael ---@Ceniza: I cannot SVN update the SourceFormatter, because it seems that your server refuses the connection. Should I try later?
--- End quote ---

I rebooted the machine where that's stored two times today (I needed its CD-ROM drive :P) and it seems svnserve wasn't started.

Ok, found the problem: I decided to add the command to start svnserve at the end of /etc/init.d/bootmisc.sh, but /etc/rcS.d/S55bootmisc.sh is a file and not a symlink so it was useless. Now I added it to the one in rcS.d :)

I just started it manually so it should work now.

Sorry for the Linux talking :P

--- End quote ---

No problem for the Linux talking :). The server works fine now. Thanks :).

Michael

Pecan:
I like the linux talking, how else are we gonna learn that greek??  :lol:

pecan

Ceniza:
Yesterday I committed the changes I made to the lexer a few days ago, and the first sketch of a formatter (nothing really).

So far the idea of the "rules" system sounds good. I'd need to define the default rules too.

It's a shame I didn't save those dialogs. More work to do again :(

There's a huge problem though: today is friday, 15:00+ here right now. My GF will surely want to come here saturday and sunday (and she won't help me with this plugin). Classes begin on monday.


--- Code: (cpp) ---limit(free_time, busy_time, all_time) | free_time = all_time - busy_time
--- End code ---


--- Quote from: Texas Instruments TI-89 ---0
--- End quote ---

:(

Ceniza:
Naming things... how time consuming can this task be?

Anyway, here is a preliminar version of the basic structures for the rules:


--- Code: (cpp) ---struct Condition
{
  TokenType cur_token;
  TokenType pre_token;
  TokenType next_token;
  State cur_state;
};

struct Actions
{
  std::vector<SingleAction> pre_actions;
  std::vector<SingleAction> post_actions;
};

struct Rule // version 1
{
  Condition cond;
  Actions acts;
};

struct Rule : Condition, Actions // version 2 (I prefer this one)
{
  // What else?
};
--- End code ---

So far the function name could be something like matches. Overloading operator == wouldn't be that a good idea.

The function could look something like this:


--- Code: (cpp) ---// kids: don't code like this :P
inline int Condition::matches(const Condition &other)
{
  return cur_token == other.cur_token ? 1 + (pre_token == other.pre_token) + (next_token == other.next_token) + (cur_state == other.cur_state) : 0;
}
--- End code ---

Quite simple: if the current token is the same, count it and all others that match, else 0.

What if two rules return the same value (there wouldn't be duplicates, just same number of matches)?

If many return values != 0 but the one with biggest return value is unique, that one would be chosen.

Even though, there sould be another evaluation like this one (var == other.var || var == NOTHING || other.var == NOTHING). So, matches must return two values: exact matches and matches with "empty" variables. A struct, vector or pair<> would do that.

Now, the way to decide which one to apply would be (order is quite important when coding this, not here :P):
* The one with biggest return value for exact matches.
* If there's more than one with the same value, then the one of those with biggest total matches (those counting "empty" cases).
* If even that way there's more than one with both number of matches the same, what to do?
* If all returned 0 for exact matches, return the one with biggest total matches.
* If there's more than one with the same value, what to do?
* If both exact and total matches are 0, it's just a "NO MATCH". Apply default rule (easy to say, but what's the default rule?).

Feedback anyone? :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version